Release #154
This file contains 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: workflow_dispatch | |
jobs: | |
changelog: | |
name: Changelog | |
runs-on: ubuntu-latest | |
concurrency: release | |
outputs: | |
skip: ${{ steps.changelog.outputs.skip }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: dtolnay/[email protected] # revert to stable on next cargo-smart-release release | |
id: rust-toolchain | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-release-${{ hashFiles('**/Cargo.toml') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-release- | |
${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}- | |
${{ runner.os }}-cargo- | |
- run: cargo install cargo-smart-release@^0.21 --locked || true | |
- run: cargo check --all --all-targets --all-features | |
- id: changelog | |
run: cargo changelog --no-preview narrow narrow-derive || echo "skip=true" >> "$GITHUB_OUTPUT" | |
release: | |
name: Release | |
needs: changelog | |
runs-on: ubuntu-latest | |
concurrency: release | |
if: needs.changelog.outputs.skip != 'true' | |
environment: | |
name: crates-io | |
url: https://crates.io/crates/narrow/${{ steps.version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.PAT }} | |
- uses: dtolnay/[email protected] # revert to stable on next cargo-smart-release release | |
id: rust-toolchain | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-release-${{ hashFiles('**/Cargo.toml') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-release- | |
${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}- | |
${{ runner.os }}-cargo- | |
- run: cargo install cargo-smart-release@^0.21 --locked || true | |
- run: | | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
- env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | |
GH_TOKEN: ${{ secrets.PAT }} | |
run: | | |
cargo smart-release \ | |
--update-crates-index \ | |
--allow-fully-generated-changelogs \ | |
--no-changelog-preview \ | |
--verbose \ | |
--execute \ | |
narrow narrow-derive | |
- id: version | |
env: | |
GH_TOKEN: ${{ secrets.PAT }} | |
run: echo "version=$(gh release view --json tagName -t '{{ slice .tagName 1 }}')" >> "$GITHUB_OUTPUT" |