Merge branch 'release/0.6.3' #14
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 & Publish Rust Binaries | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # triggers on tags like v0.4.1 | |
| - '[0-9]*' # catch numeric-only tags like 0.4.1 | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| include: | |
| - os: ubuntu-latest | |
| asset_name: cliptions-linux-v${{ github.ref_name }}.tar.gz | |
| binary_name: cliptions | |
| - os: macos-latest | |
| asset_name: cliptions-macos-v${{ github.ref_name }}.tar.gz | |
| binary_name: cliptions | |
| - os: windows-latest | |
| asset_name: cliptions-windows-v${{ github.ref_name }}.zip | |
| binary_name: cliptions.exe | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Cache Cargo registry & Git data | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Install Rust stable | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| - name: Build (release) | |
| run: cargo build --locked --release --all-targets | |
| - name: Install zip (Windows) | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh # Use PowerShell because choco is only available in PowerShell PATH | |
| run: choco install zip -y # Windows runners don't have zip by default, install via Chocolatey | |
| - name: Package binary | |
| shell: bash | |
| run: | | |
| mkdir -p dist | |
| if [ "${{ matrix.os }}" == "windows-latest" ]; then | |
| zip -j dist/${{ matrix.asset_name }} target/release/${{ matrix.binary_name }} | |
| else | |
| tar -czvf dist/${{ matrix.asset_name }} -C target/release ${{ matrix.binary_name }} | |
| fi | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-assets-${{ matrix.os }} | |
| path: dist/* | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} | |
| generate_release_notes: true | |
| files: | | |
| artifacts/release-assets-ubuntu-latest/* | |
| artifacts/release-assets-macos-latest/* | |
| artifacts/release-assets-windows-latest/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |