Skip to content

Commit fd3b944

Browse files
authored
Change release process (#1142)
1 parent ebde11d commit fd3b944

File tree

3 files changed

+67
-10
lines changed

3 files changed

+67
-10
lines changed

.github/workflows/release-drafter.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ permissions:
1111

1212
jobs:
1313
update-release-draft:
14+
concurrency:
15+
group: release-drafter
1416
permissions:
1517
contents: write
1618
pull-requests: read

.github/workflows/release.yml

Lines changed: 63 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,45 @@
1-
name: Pre-release main branch
1+
name: Release
22

33
on:
4-
release:
5-
types: [published]
6-
4+
workflow_dispatch:
5+
76
permissions:
87
contents: read
98
packages: write
109

1110
jobs:
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:
@@ -17,7 +48,8 @@ jobs:
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:
@@ -70,6 +107,8 @@ jobs:
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

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ See the [release-drafter configuration](./.github/release-drafter.yml) for more
173173

174174
## Creating a New Release
175175

176+
To create a new release trigger the [release](https://github.com/elastic/docs-builder/actions/workflows/release.yml) workflow on the `main` branch.
177+
176178
Every time a pull request is merged into the `main` branch, release-drafter will
177179
create a draft release or update the existing draft release in the [Releases](https://github.com/elastic/docs-builder/releases) page.
178180

0 commit comments

Comments
 (0)