-
Notifications
You must be signed in to change notification settings - Fork 6
86 lines (83 loc) · 2.92 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Release
on:
push:
branches:
- main
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/rust-toolchain@stable
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 [email protected] --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/rust-toolchain@stable
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 [email protected] --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"