Build and Release #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release' | |
| required: true | |
| default: 'manual' | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build-native: | |
| name: Build Native (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| artifact_name: wcanvas-macos-x86_64 | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| artifact_name: wcanvas-macos-aarch64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install dependencies (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| # No additional dependencies needed for basic build | |
| - name: Build | |
| run: | | |
| cargo build --release --target ${{ matrix.target }} | |
| - name: Create artifact directory | |
| run: mkdir -p artifacts | |
| - name: Copy binary and assets (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| cp target/${{ matrix.target }}/release/wcanvas artifacts/wcanvas | |
| cp -r data artifacts/ | |
| cp index.html artifacts/ | |
| chmod +x artifacts/wcanvas | |
| - name: Create archive | |
| run: | | |
| cd artifacts | |
| tar -czf ../${{ matrix.artifact_name }}.tar.gz * | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: ${{ matrix.artifact_name }}.tar.gz | |
| release: | |
| name: Create Release | |
| needs: [build-native] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./artifacts | |
| - name: Display structure of downloaded files | |
| run: ls -la artifacts/ | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.ref_name || github.event.inputs.version }} | |
| name: WCanvas ${{ github.ref_name || github.event.inputs.version }} | |
| body: | | |
| ## Changes | |
| - Built for macOS (x86_64 and ARM64) | |
| ## Downloads | |
| - **macOS (Intel)**: wcanvas-macos-x86_64.tar.gz | |
| - **macOS (Apple Silicon)**: wcanvas-macos-aarch64.tar.gz | |
| ## Usage | |
| 1. Download the appropriate archive for your system | |
| 2. Extract the archive | |
| 3. Run `./wcanvas` | |
| draft: false | |
| prerelease: false | |
| files: | | |
| ./artifacts/wcanvas-macos-x86_64/wcanvas-macos-x86_64.tar.gz | |
| ./artifacts/wcanvas-macos-aarch64/wcanvas-macos-aarch64.tar.gz | |