Skip to content

Commit ee59855

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 ee59855

File tree

3 files changed

+63
-37
lines changed

3 files changed

+63
-37
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: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
- uses: actions/setup-java@v5
30+
with:
31+
java-version: "17"
32+
distribution: "temurin"
33+
cache: gradle
34+
- name: Setup node
35+
uses: actions/setup-node@v6
36+
with:
37+
node-version: "20"
38+
- name: Install semantic-release
39+
shell: bash
40+
run: |
41+
npm i -g \
42+
semantic-release \
43+
@semantic-release/exec \
44+
@semantic-release/git \
45+
@semantic-release/changelog \
46+
@google/semantic-release-replace-plugin
47+
- name: Run semantic-release
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
50+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
51+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
52+
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHUSERNAME }}
53+
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHPASSWORD }}
54+
shell: bash
55+
run: |
56+
if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
57+
semantic-release --dry-run
58+
else
59+
semantic-release
60+
fi

.releaserc.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ plugins:
1313
hasChanged: true
1414
numMatches: 1
1515
numReplacements: 1
16+
- - '@semantic-release/exec'
17+
- prepareCmd: ./gradlew --stacktrace publishToSonatype
18+
publishCmd: ./gradlew --stacktrace findSonatypeStagingRepository closeAndReleaseSonatypeStagingRepository
1619
- - '@semantic-release/git'
1720
- assets:
1821
- CHANGELOG.md
1922
- build.gradle
20-
- - '@semantic-release/exec'
21-
- publishCmd: ./gradlew --stacktrace publishToSonatype closeAndReleaseSonatypeStagingRepository
2223
- - '@semantic-release/github'
2324
- assets:
2425
- agent/build/libs/appmap-*.jar*

0 commit comments

Comments
 (0)