1- name : Pre-release main branch
1+ name : Release
22
33on :
4- release :
5- types : [published]
6-
4+ workflow_dispatch :
5+
76permissions :
87 contents : read
98 packages : write
109
1110jobs :
11+
12+ release-drafter :
13+ concurrency :
14+ group : release-drafter
15+ outputs :
16+ tag_name : ${{ steps.release-drafter.outputs.tag_name }}
17+ permissions :
18+ contents : write
19+ pull-requests : read
20+ runs-on : ubuntu-latest
21+ steps :
22+ - name : Verify branch
23+ run : |
24+ if [[ "${{ github.ref }}" != refs/heads/main ]]; then
25+ echo "This workflow is only allowed to run on the main branch."
26+ exit 1
27+ fi
28+ - uses : release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5 # v6.1.0
29+ id : release-drafter
30+ env :
31+ GITHUB_TOKEN : ${{ github.token }}
32+ - name : Create tag
33+ uses : actions/github-script@v7
34+ with :
35+ script : |
36+ github.rest.git.createRef({
37+ owner: context.repo.owner,
38+ repo: context.repo.repo,
39+ ref: 'refs/tags/${{ steps.release-drafter.outputs.tag_name }}',
40+ sha: context.sha
41+ })
42+
1243 containers :
1344 runs-on : ubuntu-latest
1445 outputs :
1748
1849 steps :
1950 - uses : actions/checkout@v4
20-
51+ with :
52+ ref : ${{ steps.release-drafter.outputs.tag_name }}
2153 - name : Bootstrap Action Workspace
2254 id : bootstrap
2355 uses : ./.github/actions/bootstrap
@@ -29,16 +61,19 @@ jobs:
2961 username : ${{ github.actor }}
3062 password : ${{ secrets.GITHUB_TOKEN }}
3163
32-
3364 - name : Publish Containers
3465 run : ./build.sh publishcontainers
3566
3667 release-lambda :
3768 runs-on : ubuntu-latest
69+ needs :
70+ - release-drafter
3871 permissions :
3972 contents : write
4073 steps :
4174 - uses : actions/checkout@v4
75+ with :
76+ ref : ${{ steps.release-drafter.outputs.tag_name }}
4277 - name : Amazon Linux 2023 build
4378 run : |
4479 docker build . -t publish-links-index:latest -f src/infra/docs-lambda-index-publisher/lambda.DockerFile
@@ -50,11 +85,13 @@ jobs:
5085 - name : Attach Distribution to release
5186 env :
5287 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
53- run : gh release upload ${{ github.event. release.tag_name }} .artifacts/docs-lambda-index-publisher/release_linux-x64/bootstrap
88+ run : gh release upload ${{ needs. release-drafter.outputs .tag_name }} .artifacts/docs-lambda-index-publisher/release_linux-x64/bootstrap
5489 shell : bash
5590
5691 release :
57- needs : [containers]
92+ needs :
93+ - containers
94+ - release-drafter
5895 strategy :
5996 fail-fast : false
6097 matrix :
70107
71108 steps :
72109 - uses : actions/checkout@v4
110+ with :
111+ ref : ${{ steps.release-drafter.outputs.tag_name }}
73112
74113 - name : Bootstrap Action Workspace
75114 id : bootstrap
@@ -90,6 +129,20 @@ jobs:
90129 env :
91130 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
92131 run : |
93- gh release upload ${{ github.event. release.tag_name }} .artifacts/publish/docs-builder/release/*.zip
94- gh release upload ${{ github.event. release.tag_name }} .artifacts/publish/docs-assembler/release/*.zip
132+ gh release upload ${{ needs. release-drafter.outputs .tag_name }} .artifacts/publish/docs-builder/release/*.zip
133+ gh release upload ${{ needs. release-drafter.outputs .tag_name }} .artifacts/publish/docs-assembler/release/*.zip
95134 shell : bash
135+
136+ publish-release :
137+ needs :
138+ - release
139+ - release-lambda
140+ - release-drafter
141+ runs-on : ubuntu-latest
142+ steps :
143+ - name : Publish release
144+ env :
145+ GH_TOKEN : ${{ github.token }}
146+ TAG_NAME : ${{ needs.release-drafter.outputs.tag_name }}
147+ run : |
148+ gh release edit ${{ needs.release-drafter.outputs.tag_name }} --draft=false --latest
0 commit comments