Skip to content

Commit da8e579

Browse files
authored
Switch release flow to manual GitHub action trigger (#1091)
Trigger releases explicitly in GitHub UI rather than pushing a commit
1 parent 70e94bf commit da8e579

File tree

3 files changed

+55
-52
lines changed

3 files changed

+55
-52
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -48,51 +48,6 @@ jobs:
4848

4949
- name: Upload Test Coverage to Codecov
5050
uses: codecov/codecov-action@v3
51-
if: matrix.java == '21'
51+
if: matrix.java == '25'
5252
with:
5353
files: target/site/jacoco/jacoco.xml
54-
55-
56-
release:
57-
name: release
58-
runs-on: ubuntu-24.04
59-
needs: [build]
60-
if: github.event_name == 'push' && github.repository == 'logfellow/logstash-logback-encoder' && github.ref == 'refs/heads/main' && startsWith(github.event.commits[0].message, '[release]')
61-
steps:
62-
- name: Checkout Code
63-
uses: actions/checkout@v3
64-
with:
65-
ref: main
66-
67-
- name: Setup JAVA
68-
uses: actions/setup-java@v3
69-
with:
70-
distribution: "temurin"
71-
java-version: 25
72-
73-
- name: Setup GPG
74-
run: .github/workflows/steps/setup-gpg.sh
75-
env:
76-
GPG_KEY: ${{ secrets.GPG_KEY }}
77-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
78-
79-
- name: Setup GIT
80-
run: |
81-
.github/workflows/steps/setup-git.sh
82-
git switch main
83-
84-
- uses: actions/cache@v3
85-
with:
86-
path: |
87-
~/.m2/repository
88-
~/.m2/wrapper
89-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '.mvn/wrapper/maven-wrapper.properties') }}
90-
restore-keys: |
91-
${{ runner.os }}-maven-
92-
93-
- name: Release
94-
run: ./mvnw --batch-mode --no-transfer-progress --show-version --settings .github/maven/settings.xml --activate-profiles central-publish release:prepare release:perform
95-
env:
96-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97-
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
98-
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: release
2+
3+
on:
4+
- workflow_dispatch
5+
6+
jobs:
7+
release:
8+
name: release
9+
runs-on: ubuntu-24.04
10+
needs: [build]
11+
if: github.repository == 'logfellow/logstash-logback-encoder' && github.ref == 'refs/heads/main'
12+
steps:
13+
- name: Checkout Code
14+
uses: actions/checkout@v3
15+
with:
16+
ref: main
17+
18+
- name: Setup JAVA
19+
uses: actions/setup-java@v3
20+
with:
21+
distribution: "temurin"
22+
java-version: 25
23+
24+
- name: Setup GPG
25+
run: .github/workflows/steps/setup-gpg.sh
26+
env:
27+
GPG_KEY: ${{ secrets.GPG_KEY }}
28+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
29+
30+
- name: Setup GIT
31+
run: |
32+
.github/workflows/steps/setup-git.sh
33+
git switch main
34+
35+
- uses: actions/cache@v3
36+
with:
37+
path: |
38+
~/.m2/repository
39+
~/.m2/wrapper
40+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '.mvn/wrapper/maven-wrapper.properties') }}
41+
restore-keys: |
42+
${{ runner.os }}-maven-
43+
44+
- name: Release
45+
run: ./mvnw --batch-mode --no-transfer-progress --show-version --settings .github/maven/settings.xml --activate-profiles central-publish release:prepare release:perform
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
49+
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}

PROCESS.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@ In other words, older releases will not be hotfixed, and backports will not be p
3131
Releasing
3232
---------
3333

34-
To perform a release, push a commit ([like this one](https://github.com/logfellow/logstash-logback-encoder/commit/aa942e9fe59320fa1b39f1b54f8a742dd8fd9930))
35-
to the `main` branch that:
34+
To perform a release, first, prepare the `main` branch:
35+
1. Set the version in the [pom.xml](pom.xml) to `X.Y-SNAPSHOT`, where `X.Y` is the version to be released.
36+
2. Bump the version references in the [README.md](README.md)
3637

37-
1. Bumps the version references in the README.md
38-
2. Contains a commit message that starts with `[release]`
38+
Then trigger the https://github.com/logfellow/logstash-logback-encoder/actions/workflows/release.yml on the main branch.
3939

40-
The [build workflow](.github/workflows/build.yml) sees `[release]` in the commit message
41-
and uses the `maven-release-plugin` to perform the release, which then:
40+
The [release workflow](.github/workflows/release.yml) triggers a maven release via the `maven-release-plugin`, which then:
4241

4342
1. Strips the `-SNAPSHOT` from the pom version,
4443
2. Creates the git tag, and builds the artifacts

0 commit comments

Comments
 (0)