Skip to content

Commit 5a69c23

Browse files
committed
ci: Extract release workflow into a dedicated file
Moves the GitHub Actions release job from `build-and-test.yml` into a new, standalone `release.yml` workflow. This improves modularity and clarity of the CI/CD pipeline, allowing for better management and triggering of the release process. The new workflow is configured to run upon completion of the 'Build and test' workflow or via manual `workflow_dispatch`, with a dry-run option available for testing.
1 parent ee32244 commit 5a69c23

File tree

2 files changed

+62
-35
lines changed

2 files changed

+62
-35
lines changed

.github/workflows/build-and-test.yml

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -108,38 +108,3 @@ jobs:
108108
TERM: xterm
109109
working-directory: ./agent
110110
run: bin/test_run
111-
112-
release:
113-
name: Release
114-
runs-on: ubuntu-latest
115-
needs: test-suite
116-
if: ${{ github.ref == 'refs/heads/master' }}
117-
steps:
118-
- uses: actions/checkout@v4
119-
with:
120-
persist-credentials: false
121-
- uses: actions/setup-java@v4
122-
with:
123-
java-version: '17'
124-
distribution: 'temurin'
125-
- name: Setup Gradle
126-
uses: gradle/actions/setup-gradle@v4
127-
- uses: actions/download-artifact@v4
128-
with:
129-
name: Jars
130-
- name: Install semantic-release
131-
run: |
132-
npm i -g \
133-
semantic-release \
134-
@semantic-release/exec \
135-
@semantic-release/git \
136-
@semantic-release/changelog \
137-
@google/semantic-release-replace-plugin
138-
- name: Run semantic-release
139-
env:
140-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
141-
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
142-
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
143-
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHUSERNAME }}
144-
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHPASSWORD }}
145-
run: semantic-release

.github/workflows/release.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Release
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build and test"]
6+
types:
7+
- completed
8+
workflow_dispatch:
9+
inputs:
10+
dry_run:
11+
description: "Run in dry-run mode (no publish)"
12+
required: false
13+
default: "true"
14+
15+
jobs:
16+
release:
17+
name: Release
18+
runs-on: ubuntu-latest
19+
concurrency:
20+
group: "release"
21+
cancel-in-progress: true
22+
permissions:
23+
contents: write
24+
issues: write
25+
pull-requests: write
26+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'master')
27+
steps:
28+
- uses: actions/checkout@v5
29+
with:
30+
persist-credentials: false
31+
- uses: actions/setup-java@v5
32+
with:
33+
java-version: "17"
34+
distribution: "temurin"
35+
cache: gradle
36+
- name: Setup node
37+
uses: actions/setup-node@v6
38+
with:
39+
node-version: "20"
40+
- name: Install semantic-release
41+
shell: bash
42+
run: |
43+
npm i -g \
44+
semantic-release \
45+
@semantic-release/exec \
46+
@semantic-release/git \
47+
@semantic-release/changelog \
48+
@google/semantic-release-replace-plugin
49+
- name: Run semantic-release
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
52+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
53+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
54+
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHUSERNAME }}
55+
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHPASSWORD }}
56+
shell: bash
57+
run: |
58+
if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
59+
semantic-release --dry-run
60+
else
61+
semantic-release
62+
fi

0 commit comments

Comments
 (0)