Prepare release artifacts for GitHub Release #10
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 | |
| permissions: | |
| contents: write | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" # Trigger on version tags | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| platform: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| target: ${{ matrix.platform }} | |
| override: true | |
| - name: Install cross-compilation tools for ARM | |
| if: matrix.platform == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| sudo apt update | |
| sudo apt install -y gcc-aarch64-linux-gnu | |
| - name: Build | |
| run: cargo build --release --target ${{ matrix.platform }} | |
| env: | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: KeyResolve-${{ matrix.platform }} | |
| path: target/${{ matrix.platform }}/release/KeyResolve | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./dist | |
| - name: Prepare release artifacts | |
| run: | | |
| mkdir -p release_files | |
| cp dist/KeyResolve-x86_64-unknown-linux-gnu/KeyResolve release_files/KeyResolve-x86_64 | |
| cp dist/KeyResolve-aarch64-unknown-linux-gnu/KeyResolve release_files/KeyResolve-aarch64 | |
| - name: Create GitHub Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| artifacts: release_files/* | |
| tag: ${{ github.ref_name }} |