fix: WolfDisk --version now reads from Cargo.toml, bump to 2.7.4 #6
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: WolfDisk — Build Release Binaries | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'wolfdisk/Cargo.toml' | |
| - 'wolfdisk/src/**' | |
| - 'wolfdisk/Cross.toml' | |
| - '.github/workflows/wolfdisk-release.yml' | |
| workflow_dispatch: | |
| defaults: | |
| run: | |
| working-directory: wolfdisk | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-musl | |
| arch: x86_64 | |
| runner: ubuntu-latest | |
| - target: aarch64-unknown-linux-musl | |
| arch: aarch64 | |
| runner: ubuntu-latest | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install cross | |
| run: cargo install cross --git https://github.com/cross-rs/cross | |
| working-directory: . | |
| - name: Build static binaries | |
| run: cross build --release --target ${{ matrix.target }} | |
| - name: Get version | |
| id: version | |
| run: echo "version=$(grep '^version' Cargo.toml | head -1 | sed 's/.*\"\(.*\)\".*/\1/')" >> "$GITHUB_OUTPUT" | |
| - name: Package binaries | |
| run: | | |
| mkdir -p dist | |
| cp target/${{ matrix.target }}/release/wolfdisk dist/wolfdisk-${{ matrix.arch }} | |
| cp target/${{ matrix.target }}/release/wolfdiskctl dist/wolfdiskctl-${{ matrix.arch }} | |
| chmod +x dist/wolfdisk-${{ matrix.arch }} | |
| chmod +x dist/wolfdiskctl-${{ matrix.arch }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wolfdisk-${{ matrix.arch }} | |
| path: wolfdisk/dist/* | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get version | |
| id: version | |
| run: echo "version=$(grep '^version' Cargo.toml | head -1 | sed 's/.*\"\(.*\)\".*/\1/')" >> "$GITHUB_OUTPUT" | |
| working-directory: wolfdisk | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Create or update release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| VERSION="v${{ steps.version.outputs.version }}-wolfdisk" | |
| # Delete existing release if it exists (update scenario) | |
| gh release delete "$VERSION" --yes 2>/dev/null || true | |
| git push --delete origin "$VERSION" 2>/dev/null || true | |
| # Create release with binaries | |
| gh release create "$VERSION" \ | |
| --title "WolfDisk ${{ steps.version.outputs.version }}" \ | |
| --notes "Prebuilt static binaries for Linux x86_64 and aarch64 (ARM64/Raspberry Pi 4+)." \ | |
| dist/wolfdisk-x86_64 \ | |
| dist/wolfdisk-aarch64 \ | |
| dist/wolfdiskctl-x86_64 \ | |
| dist/wolfdiskctl-aarch64 | |
| working-directory: . |