Skip to content

Commit cf3ea6a

Browse files
authored
Refactor GitHub Actions workflows (#1298)
2 parents 7ac5f95 + 66deb4f commit cf3ea6a

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
${{ env.JDK_VERSION_LATEST_LTS }}
3636
3737
- name: Set up Gradle
38-
uses: gradle/[email protected].0
38+
uses: gradle/actions/[email protected].0
3939

4040
- name: Build
4141
run: >

.github/workflows/release-draft.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ jobs:
2323
- uses: release-drafter/release-drafter@v6
2424
env:
2525
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
with:
27+
commitish: master

.github/workflows/release.yml

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,18 @@ jobs:
2222
if: github.event.inputs.version != null
2323
run: echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
2424

25-
- uses: actions/github-script@v7
25+
- name: Get latest draft release title
2626
if: github.event.inputs.version == null
27-
id: candidate-version
28-
with:
29-
github-token: ${{secrets.GITHUB_TOKEN}}
30-
result-encoding: string
31-
script: |
32-
const list = await github.rest.repos.listReleases({
33-
owner: "domaframework",
34-
repo: "doma",
35-
});
36-
console.log(list)
37-
return list.data[0].name
38-
39-
- name: Assign candidate version
40-
if: github.event.inputs.version == null
41-
run: echo "RELEASE_VERSION=${{ steps.candidate-version.outputs.result }}" >> $GITHUB_ENV
27+
run: |
28+
TITLE=$(gh api repos/${{ github.repository }}/releases \
29+
--jq '.[] | select(.draft==true) | .name' | head -n 1)
30+
if [[ -z "$TITLE" ]]; then
31+
echo "No draft release found."
32+
exit 1
33+
fi
34+
echo "RELEASE_VERSION=$TITLE" >> $GITHUB_ENV
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4237

4338
- name: Set up the latest LTS JDK
4439
uses: actions/setup-java@v4
@@ -57,7 +52,7 @@ jobs:
5752
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
5853
5954
- name: Set up Gradle
60-
uses: gradle/[email protected].0
55+
uses: gradle/actions/[email protected].0
6156

6257
- name: Release ${{ env.RELEASE_VERSION }}
6358
run: >

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ rootProject.apply {
309309
release {
310310
newVersionCommitMessage.set("[Gradle Release Plugin] - [skip ci] new version commit: ")
311311
git {
312-
requireBranch.set("master")
312+
requireBranch.set("")
313313
}
314314
}
315315

0 commit comments

Comments
 (0)