Release #1
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: | |
| preflight: | |
| name: Preflight checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check that tag matches version in Cargo.toml | |
| run: | | |
| version=$(cargo pkgid | cut -d'#' -f2) | |
| if [ "$version" != "${{ github.ref_name }}" ]; then | |
| echo "Tag version does not match Cargo.toml version" | |
| echo "Tag: ${{ github.ref_name }}, Cargo.toml: $version" | |
| exit 1 | |
| fi | |
| ci: | |
| name: Run CI | |
| needs: preflight | |
| 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: Install cross | |
| if: ${{ matrix.runs-on == 'ubuntu-latest' }} | |
| run: cargo install cross --git https://github.com/cross-rs/cross | |
| # This step seems absolutely necessary for 'cross' to work. | |
| - name: Clean build cache | |
| run: cargo clean | |
| - name: Build (Windows) | |
| if: ${{ matrix.runs-on == 'windows-latest' }} | |
| run: cargo build --release --all-features --target=${{ matrix.target }} | |
| - name: Build (Linux, cross compile) | |
| if: ${{ matrix.runs-on == 'ubuntu-latest' }} | |
| run: cross build --release --all-features --target=${{ matrix.target }} | |
| - 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 | |
| - 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 release/ | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| if: github.ref_type == 'tag' | |
| with: | |
| files: | | |
| csm*.zip | |
| csm*.tar.gz | |
| test-release: | |
| name: Post-release test | |
| needs: release | |
| runs-on: ${{ matrix.runs-on }} | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runs-on: windows-latest | |
| - runs-on: ubuntu-latest | |
| steps: | |
| - name: Try latest release (linux) | |
| if: ${{ matrix.runs-on == 'ubuntu-latest' }} | |
| run: | | |
| wget https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/csm-${{ github.ref_name }}-x86_64-unknown-linux-musl.tar.gz | |
| tar -xvf csm-*.tar.gz | |
| ./release/csm --version | |
| - name: Try latest release (windows) | |
| if: ${{ matrix.runs-on == 'windows-latest' }} | |
| run: | | |
| Invoke-WebRequest -Uri https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/csm-${{ github.ref_name }}-x86_64-pc-windows-msvc.zip -OutFile csm-${{ github.ref_name }}-x86_64-pc-windows-msvc.zip | |
| Expand-Archive -Path csm-${{ github.ref_name }}-x86_64-pc-windows-msvc.zip -DestinationPath . | |
| .\release\csm.exe --version |