documentation #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
| # Adopted from https://github.com/azriel91/peace/blob/main/.github/workflows/publish.yml | |
| # Copyright 2023 Azriel Hoh MIT / Apache-2.0 | |
| name: Publish | |
| on: | |
| push: | |
| tags: | |
| - "*" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| audit: | |
| name: Audit | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: cargo-audit cache restore | |
| id: cargo-audit_cache_restore | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ~/.cargo/bin/cargo-audit | |
| key: ${{ runner.os }}-cargo-audit | |
| - run: cargo install cargo-audit | |
| if: steps.cargo-audit_cache_restore.outputs.cache-hit != 'true' | |
| - name: cargo-audit cache save | |
| id: cargo-audit_cache_save | |
| uses: actions/cache/save@v4 | |
| if: always() && steps.cargo-audit_cache_restore.outputs.cache-hit != 'true' | |
| with: | |
| path: ~/.cargo/bin/cargo-audit | |
| key: ${{ runner.os }}-cargo-audit | |
| - uses: rustsec/audit-check@v2 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| build_and_test_linux: | |
| name: Build and Test (Linux) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Install cargo-nextest | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: nextest | |
| - name: Install cargo-rdme | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-rdme | |
| - name: "Is readme up to date?" | |
| run: cargo rdme --check | |
| - name: "Build and test" | |
| run: cargo nextest run --workspace --all-features | |
| crates_io_publish: | |
| name: Publish (crates.io) | |
| needs: | |
| - audit | |
| - build_and_test_linux | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 25 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: cargo-release cache restore | |
| id: cargo_release_cache_restore | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ~/.cargo/bin/cargo-release | |
| key: ${{ runner.os }}-cargo-release | |
| - run: cargo install cargo-release | |
| if: steps.cargo_release_cache_restore.outputs.cache-hit != 'true' | |
| - name: cargo-release cache save | |
| id: cargo_release_cache_save | |
| uses: actions/cache/save@v4 | |
| if: always() && steps.cargo_release_cache_restore.outputs.cache-hit != 'true' | |
| with: | |
| path: ~/.cargo/bin/cargo-release | |
| key: ${{ runner.os }}-cargo-release | |
| - name: cargo login | |
| run: |- | |
| echo "${{ secrets.CRATES_IO_API_TOKEN }}" | cargo login | |
| # allow-branch HEAD is because GitHub actions switches | |
| # to the tag while building, which is a detached head | |
| - name: "cargo release publish" | |
| run: |- | |
| cargo release \ | |
| publish \ | |
| --workspace \ | |
| --allow-branch HEAD \ | |
| --no-confirm \ | |
| --execute |