File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Publish a version on crates.io
2+ on :
3+ pull_request :
4+ types :
5+ - closed
6+
7+ jobs :
8+ tag_github_release :
9+ environment :
10+ name : release
11+ if : github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')
12+
13+ permissions :
14+ id-token : write # Enable OIDC
15+ contents : write
16+
17+ runs-on : ubuntu-latest
18+ steps :
19+ - run : echo merge commit is $GITHUB_SHA, from PR branch ${{ github.event.pull_request.head.ref }}
20+ - uses : actions-ecosystem/action-regex-match@v2
21+ id : version
22+ with :
23+ text : ${{ github.event.pull_request.head.ref }}
24+ regex : " ^release/([^/]+)/(.+)$"
25+ # Name of crate is steps.version.outputs.group1, version is steps.version.outputs.group2.
26+ # TODO: figure out how this works with workspaces & multiple crates
27+
28+ - name : Create release v${{steps.version.outputs.group2}}
29+ uses : softprops/action-gh-release@v2
30+ with :
31+ tag_name : v${{ steps.version.outputs.group2 }}
32+ name : ${{steps.version.outputs.group1}} v${{ steps.version.outputs.group2 }}
33+ target_commitish : ${{github.sha}}
34+
35+ - name : Install stable toolchain
36+ uses : actions-rs/toolchain@v1
37+ with :
38+ profile : minimal
39+ toolchain : stable
40+
41+ - uses : rust-lang/crates-io-auth-action@e919bc7605cde86df457cf5b93c5e103838bd879
42+ id : auth
43+
44+ - uses : actions/checkout@v4
45+ - run : cargo publish -p ${{ steps.version.outputs.group1 }}
46+ env :
47+ CARGO_REGISTRY_TOKEN : ${{ steps.auth.outputs.token }}
You can’t perform that action at this time.
0 commit comments