fix: respect project dependencies in next commands and task.next trig… #25
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: Release | |
| on: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| check: | |
| name: Check for release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| released: ${{ steps.boop.outputs.released }} | |
| version: ${{ steps.boop.outputs.version }} | |
| changelog: ${{ steps.boop.outputs.changelog }} | |
| sha: ${{ steps.release.outputs.sha }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run boop | |
| id: boop | |
| uses: danielkov/boop@v1 | |
| - name: Update Cargo.toml and tag | |
| id: release | |
| if: steps.boop.outputs.released == 'true' | |
| run: | | |
| VERSION="${{ steps.boop.outputs.version }}" | |
| # Install Rust for cargo update | |
| rustup default stable | |
| # Update workspace version in Cargo.toml | |
| sed -i "s/^version = \"[0-9]*\.[0-9]*\.[0-9]*\"/version = \"$VERSION\"/" Cargo.toml | |
| cargo update --workspace | |
| # Commit and tag | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add .boop/releases.toml Cargo.toml Cargo.lock | |
| git commit -m "ci(boop): release $VERSION [skip ci] | |
| ${{ steps.boop.outputs.changelog }}" | |
| git tag "v$VERSION" | |
| git push origin main --follow-tags | |
| echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | |
| build: | |
| name: Build ${{ matrix.target }} | |
| needs: [check] | |
| if: needs.check.outputs.released == 'true' | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # macOS | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| archive: tar.gz | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| archive: tar.gz | |
| # Linux | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| archive: tar.gz | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| archive: tar.gz | |
| cross: true | |
| # Windows | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| archive: zip | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ needs.check.outputs.sha }} | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install system dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libxkbcommon-dev libwayland-dev libvulkan-dev pkg-config | |
| - name: Install cross-compilation tools | |
| if: matrix.cross | |
| uses: taiki-e/setup-cross-toolchain-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| - name: Build | |
| run: cargo build --workspace --release --target ${{ matrix.target }} | |
| - name: Create Silo.app bundle | |
| if: runner.os == 'macOS' | |
| run: | | |
| mkdir -p Silo.app/Contents/MacOS Silo.app/Contents/Resources | |
| cp target/${{ matrix.target }}/release/silo Silo.app/Contents/MacOS/Silo | |
| cp crates/silo/resources/AppIcon.icns Silo.app/Contents/Resources/AppIcon.icns | |
| VERSION="${{ needs.check.outputs.version }}" | |
| cat > Silo.app/Contents/Info.plist << PLIST | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>CFBundleName</key><string>Silo</string> | |
| <key>CFBundleDisplayName</key><string>Silo</string> | |
| <key>CFBundleExecutable</key><string>Silo</string> | |
| <key>CFBundleIdentifier</key><string>com.granary.silo</string> | |
| <key>CFBundleVersion</key><string>$VERSION</string> | |
| <key>CFBundleShortVersionString</key><string>$VERSION</string> | |
| <key>CFBundlePackageType</key><string>APPL</string> | |
| <key>CFBundleIconFile</key><string>AppIcon</string> | |
| <key>NSHighResolutionCapable</key><true/> | |
| </dict> | |
| </plist> | |
| PLIST | |
| - name: Package (Unix) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| if [ -d ../../../Silo.app ]; then | |
| tar -czvf ../../../granary-${{ matrix.target }}.tar.gz granary granaryd silo -C ../../.. Silo.app | |
| else | |
| tar -czvf ../../../granary-${{ matrix.target }}.tar.gz granary granaryd silo | |
| fi | |
| cd ../../.. | |
| - name: Package (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| 7z a ../../../granary-${{ matrix.target }}.zip granary.exe granaryd.exe silo.exe | |
| cd ../../.. | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: granary-${{ matrix.target }} | |
| path: granary-${{ matrix.target }}.${{ matrix.archive }} | |
| release: | |
| name: Create Release | |
| needs: [check, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Prepare release files | |
| run: | | |
| mkdir -p release | |
| find artifacts -type f \( -name "*.tar.gz" -o -name "*.zip" \) -exec mv {} release/ \; | |
| ls -la release/ | |
| - name: Generate checksums | |
| run: | | |
| cd release | |
| sha256sum * > checksums.sha256 | |
| cat checksums.sha256 | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ needs.check.outputs.version }} | |
| name: v${{ needs.check.outputs.version }} | |
| body: ${{ needs.check.outputs.changelog }} | |
| files: | | |
| release/* | |
| draft: false | |
| prerelease: ${{ contains(needs.check.outputs.version, '-') }} |