test #15
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: | |
| push: | |
| tags: | |
| - '*' | |
| jobs: | |
| ci: | |
| name: Run CI | |
| uses: ./.github/workflows/ci-reusable.yml | |
| release: | |
| needs: ci | |
| runs-on: ${{ matrix.runs-on }} | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runs-on: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| - runs-on: windows-latest | |
| target: i686-pc-windows-msvc | |
| - runs-on: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| - runs-on: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| - runs-on: ubuntu-latest | |
| target: i686-unknown-linux-musl | |
| - runs-on: ubuntu-latest | |
| target: aarch64-unknown-linux-musl | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| components: clippy, rustfmt | |
| rustflags: "" | |
| target: ${{ matrix.target }} | |
| - name: Build deps (musl) | |
| if: ${{ matrix.runs-on == 'ubuntu-latest' }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools gcc-multilib | |
| # Install aarch64 cross-compiler if needed | |
| if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-musl" ]]; then | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| fi | |
| - name: Build | |
| run: cargo build --release --all-features --target=${{ matrix.target }} | |
| env: | |
| # Set linker for aarch64 | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc | |
| - name: Create a zip (windows) | |
| id: create-zip | |
| if: ${{ matrix.runs-on == 'windows-latest' }} | |
| run: | | |
| mkdir release | |
| cp LICENSE release/ | |
| cp target/${{ matrix.target }}/release/csm.exe release/ | |
| Compress-Archive -Path release/* -DestinationPath csm-${{ github.ref_name }}-${{ matrix.target }}.zip | |
| echo "archive=csm-${{ github.ref_name }}-${{ matrix.target }}.zip" >> $GITHUB_OUTPUT | |
| - name: Create a tar.gz (linux) | |
| id: create-tar | |
| if: ${{ matrix.runs-on == 'ubuntu-latest' }} | |
| run: | | |
| mkdir release | |
| cp LICENSE release/ | |
| cp target/${{ matrix.target }}/release/csm release/ | |
| tar -czvf csm-${{ github.ref_name }}-${{ matrix.target }}.tar.gz -C release . | |
| echo "archive=csm-${{ github.ref_name }}-${{ matrix.target }}.tar.gz" >> $GITHUB_OUTPUT | |
| - name: Set archive output | |
| id: archive | |
| run: echo "file=${{ steps.create-zip.outputs.archive }}${{ steps.create-tar.outputs.archive }}" >> $GITHUB_OUTPUT | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| if: github.ref_type == 'tag' | |
| with: | |
| files: ${{ steps.archive.outputs.file }} |