1- name : Release (GitHub)
1+ name : Release
22concurrency : release-git
33on :
44 workflow_dispatch : { }
1010 CARGO_INCREMENTAL : 0
1111
1212jobs :
13- git :
14- name : Git release
13+ test :
14+ name : Test
15+ uses : ./.github/workflows/test.yml
16+
17+ bump :
18+ name : Bump version
19+ needs : [ test ]
1520 runs-on : ubuntu-latest
1621 environment : github
17- permissions :
18- contents : write
1922 outputs :
20- issues-closed : ${{ steps.changelog.outputs.issues-closed }}
23+ commit : ${{ steps.last-commit.outputs.sha }}
24+ changelog : ${{ steps.changelog.outputs.changelog }}
2125 version : ${{ steps.changelog.outputs.version }}
26+ issues-closed : ${{ steps.changelog.outputs.issues-closed }}
2227 steps :
2328 - uses : actions/checkout@v4
2429 name : Checkout
@@ -44,35 +49,81 @@ jobs:
4449 with :
4550 release-type : ${{ steps.changelog.outputs.release-type }}
4651
47- - name : Git release
48- uses : alorel-actions/cargo/release-git@v2
52+ - name : Commit version bump
53+ run : |
54+ git commit -m "$(cat <<-END
55+ Bump version to ${{ steps.changelog.outputs.version }}
56+
57+ [ci skip]
58+ END
59+ )"
60+
61+ - name : Git tag
62+ run : git tag "${{ steps.changelog.outputs.version }}"
63+
64+ - name : Get last commit sha
65+ id : last-commit
66+ run : echo "sha=$(git log -n 1 --pretty=format:%H)" >> $GITHUB_OUTPUT
67+
68+ - name : Push commit
69+ run : git push
70+
71+ - name : Push tag
72+ run : git push --tags
73+
74+ release-cargo :
75+ name : Release (Cargo)
76+ needs : [ bump ]
77+ runs-on : ubuntu-latest
78+ environment : crates-io
79+ env :
80+ CARGO_INCREMENTAL : 0
81+ steps :
82+ - uses : actions/checkout@v4
83+ name : Checkout
84+ with :
85+ fetch-depth : 1
86+ ref : ${{ needs.bump.outputs.commit }}
87+
88+ - name : Init toolchain
89+ uses : alorel-actions/cargo/init@v2
4990 with :
50- version : ${{ steps.changelog.outputs.version }}
51- changelog : ${{ steps.changelog.outputs.changelog }}
52-
53- notify :
54- name : Notify closed issues
55- needs :
56- - git
57- if : ${{ needs.git.outputs.issues-closed }}
91+ cache-prefix : release
92+
93+ - name : Publish crate
94+ run : cargo publish --locked --token ${{ secrets.CRATES_IO_TOKEN }}
95+
96+ release-github :
97+ name : Release (GitHub)
98+ needs : [ release-cargo, bump ]
5899 runs-on : ubuntu-latest
59- environment : github
60100 permissions :
61101 contents : write
62102 steps :
63103 - uses : actions/checkout@v4
64104 name : Checkout
65105 with :
66- token : ${{ secrets.GH_TOKEN }}
106+ fetch-depth : 1
107+ ref : ${{ needs.bump.outputs.commit }}
67108
68109 - name : Git identity
69110 uses : alorel-actions/git-ident@v1
70111
112+ - name : Create release
113+ uses : ncipollo/release-action@36e78ab6296394ce36f72f6488e68c2353b50514
114+ with :
115+ allowUpdates : false
116+ prerelease : false
117+ generateReleaseNotes : false
118+ commit : ${{ needs.bump.outputs.commit }}
119+ tag : ${{ needs.bump.outputs.version }}
120+ body : ${{ needs.bump.outputs.changelog }}
121+
71122 - name : Notify
72- if : ${{ needs.git .outputs.issues-closed }}
123+ if : ${{ needs.bump .outputs.issues-closed }}
73124 uses : alorel-actions/semantic-release-lite/notify@v0
74125 with :
75- tag : ${{ needs.git .outputs.version }}
76- issues : ${{ needs.git .outputs.issues-closed }}
126+ tag : ${{ needs.bump .outputs.version }}
127+ issues : ${{ needs.bump .outputs.issues-closed }}
77128 allow-out-of-sync : true
78- gh-token : ${{ secrets.GH_TOKEN }}
129+ gh-token : ${{ github.token }}
0 commit comments