v0.2.25 #32
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: Release | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-upload: | |
| name: Build and Upload Release Assets | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| # Linux builds use musl for universal compatibility (no GLIBC dependency) | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| binary_name: dotstate | |
| asset_name: dotstate-x86_64-unknown-linux-musl | |
| use_cross: true | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-musl | |
| binary_name: dotstate | |
| asset_name: dotstate-aarch64-unknown-linux-musl | |
| use_cross: true | |
| # macOS builds use native toolchain | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| binary_name: dotstate | |
| asset_name: dotstate-x86_64-apple-darwin | |
| use_cross: false | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| binary_name: dotstate | |
| asset_name: dotstate-aarch64-apple-darwin | |
| use_cross: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cache Cargo dependencies | |
| uses: swatinem/rust-cache@v2 | |
| with: | |
| workspaces: '.' | |
| # Linux builds use cross for musl static linking | |
| - name: Install cross | |
| if: matrix.use_cross | |
| run: cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Build with cross (Linux musl) | |
| if: matrix.use_cross | |
| run: cross build --release --target ${{ matrix.target }} | |
| # macOS builds use native cargo | |
| - name: Build with cargo (macOS) | |
| if: "!matrix.use_cross" | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Create archive | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| tar czf ${{ github.workspace }}/${{ matrix.asset_name }}.tar.gz ${{ matrix.binary_name }} | |
| cd ${{ github.workspace }} | |
| shasum -a 256 ${{ matrix.asset_name }}.tar.gz | awk '{print $1}' > ${{ matrix.asset_name }}.tar.gz.sha256 | |
| ls -lh ${{ matrix.asset_name }}.tar.gz ${{ matrix.asset_name }}.tar.gz.sha256 | |
| - name: Verify files exist | |
| run: | | |
| echo "Checking for files in ${{ github.workspace }}:" | |
| ls -la ${{ github.workspace }}/${{ matrix.asset_name }}.tar.gz || echo "❌ Archive not found" | |
| ls -la ${{ github.workspace }}/${{ matrix.asset_name }}.tar.gz.sha256 || echo "❌ Checksum not found" | |
| - name: Verify binary is statically linked (Linux) | |
| if: matrix.use_cross | |
| run: | | |
| echo "Checking binary type..." | |
| file target/${{ matrix.target }}/release/${{ matrix.binary_name }} | |
| echo "" | |
| echo "Checking for dynamic dependencies..." | |
| # musl binaries should show "statically linked" or have no dynamic deps | |
| if ldd target/${{ matrix.target }}/release/${{ matrix.binary_name }} 2>&1 | grep -q "not a dynamic executable"; then | |
| echo "✅ Binary is statically linked (no dynamic dependencies)" | |
| else | |
| echo "⚠️ Binary may have dynamic dependencies (this is OK for some musl builds)" | |
| ldd target/${{ matrix.target }}/release/${{ matrix.binary_name }} || true | |
| fi | |
| - name: Upload to release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| ${{ github.workspace }}/${{ matrix.asset_name }}.tar.gz | |
| ${{ github.workspace }}/${{ matrix.asset_name }}.tar.gz.sha256 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |