Skip to content

Commit dd192d4

Browse files
committed
chore: fix release-drafter so it uses the version from gradle.properties
Previously, release drafter was inferring v0.0.1. Now we force the proper version for the draft.
1 parent 16b13bc commit dd192d4

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

.github/workflows/release-drafter.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,36 @@ on:
88
- 'release/**'
99
# pull_request_target allows PR from forks to access secrets, so please NEVER add pull_request_target
1010

11+
# Declare default permissions as read-only.
12+
permissions: read-all
13+
1114
jobs:
1215
update_release_draft:
1316
# Skip release drafts in forks
14-
if: github.repository_owner == 'apache'
17+
if: vars.RUN_RELEASE_DRAFTER == 'true'
1518
name: Update Release Draft
1619
runs-on: ubuntu-latest
20+
permissions:
21+
# write permission is required to create a github release
22+
contents: write
1723
steps:
24+
- name: Get the current version
25+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
26+
id: current_version
27+
with:
28+
# language=javascript
29+
script: |
30+
const response = await github.rest.repos.getContent({
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
path: 'gradle.properties',
34+
ref: context.sha
35+
});
36+
const content = Buffer.from(response.data.content, 'base64').toString();
37+
const version = content.match(/^jmeter\.version=(.+)$/m)[1];
38+
console.log(`Version is ${version}`);
39+
return version;
40+
1841
# Drafts your next Release notes as Pull Requests are merged into "master"
1942
- name: Update release body draft
2043
uses: release-drafter/release-drafter@09c613e259eb8d4e7c81c2cb00618eb5fc4575a7 # v5
@@ -23,5 +46,8 @@ jobs:
2346
with:
2447
# config-name: my-config.yml
2548
disable-autolabeler: true
49+
publish: false
50+
latest: ${{ github.ref_name == github.event.repository.default_branch }}
51+
version: ${{ steps.current_version.outputs.result }}
2652
env:
2753
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)