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
9+
10+ concurrency :
11+ group : release-drafter
1012
1113jobs :
14+
15+ release-drafter :
16+ outputs :
17+ tag_name : ${{ steps.release-drafter.outputs.tag_name }}
18+ permissions :
19+ contents : write
20+ pull-requests : read
21+ runs-on : ubuntu-latest
22+ steps :
23+ - name : Verify branch
24+ run : |
25+ if [[ "${{ github.ref }}" != refs/heads/main ]]; then
26+ echo "This workflow is only allowed to run on the main branch."
27+ exit 1
28+ fi
29+ - uses : release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5 # v6.1.0
30+ id : release-drafter
31+ env :
32+ GITHUB_TOKEN : ${{ github.token }}
33+ - name : Create tag
34+ uses : actions/github-script@v7
35+ with :
36+ script : |
37+ github.rest.git.createRef({
38+ owner: context.repo.owner,
39+ repo: context.repo.repo,
40+ ref: 'refs/tags/${{ steps.release-drafter.outputs.tag_name }}',
41+ sha: context.sha
42+ })
43+
1244 containers :
1345 runs-on : ubuntu-latest
1446 outputs :
1749
1850 steps :
1951 - uses : actions/checkout@v4
20-
52+ with :
53+ ref : ${{ steps.release-drafter.outputs.tag_name }}
2154 - name : Bootstrap Action Workspace
2255 id : bootstrap
2356 uses : ./.github/actions/bootstrap
@@ -29,16 +62,19 @@ jobs:
2962 username : ${{ github.actor }}
3063 password : ${{ secrets.GITHUB_TOKEN }}
3164
32-
3365 - name : Publish Containers
3466 run : ./build.sh publishcontainers
3567
3668 release-lambda :
3769 runs-on : ubuntu-latest
70+ needs :
71+ - release-drafter
3872 permissions :
3973 contents : write
4074 steps :
4175 - uses : actions/checkout@v4
76+ with :
77+ ref : ${{ steps.release-drafter.outputs.tag_name }}
4278 - name : Amazon Linux 2023 build
4379 run : |
4480 docker build . -t publish-links-index:latest -f src/infra/docs-lambda-index-publisher/lambda.DockerFile
@@ -50,11 +86,13 @@ jobs:
5086 - name : Attach Distribution to release
5187 env :
5288 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
53- run : gh release upload ${{ github.event. release.tag_name }} .artifacts/docs-lambda-index-publisher/release_linux-x64/bootstrap
89+ run : gh release upload ${{ needs. release-drafter.outputs .tag_name }} .artifacts/docs-lambda-index-publisher/release_linux-x64/bootstrap
5490 shell : bash
5591
5692 release :
57- needs : [containers]
93+ needs :
94+ - containers
95+ - release-drafter
5896 strategy :
5997 fail-fast : false
6098 matrix :
70108
71109 steps :
72110 - uses : actions/checkout@v4
111+ with :
112+ ref : ${{ steps.release-drafter.outputs.tag_name }}
73113
74114 - name : Bootstrap Action Workspace
75115 id : bootstrap
@@ -90,6 +130,20 @@ jobs:
90130 env :
91131 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
92132 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
133+ gh release upload ${{ needs. release-drafter.outputs .tag_name }} .artifacts/publish/docs-builder/release/*.zip
134+ gh release upload ${{ needs. release-drafter.outputs .tag_name }} .artifacts/publish/docs-assembler/release/*.zip
95135 shell : bash
136+
137+ publish-release :
138+ needs :
139+ - release
140+ - release-lambda
141+ - release-drafter
142+ runs-on : ubuntu-latest
143+ steps :
144+ - name : Publish release
145+ env :
146+ GH_TOKEN : ${{ github.token }}
147+ TAG_NAME : ${{ needs.release-drafter.outputs.tag_name }}
148+ run : |
149+ gh release edit ${{ needs.release-drafter.outputs.tag_name }} --draft=false --latest --repo ${{ github.repository }}
0 commit comments