Skip to content

Commit 3e60584

Browse files
committed
Add release automation with GitHub Actions
Lifted from Airlift and adapted
1 parent eabda99 commit 3e60584

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

.github/workflows/release.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Release new version
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
packages: write
12+
env:
13+
STAGED_REPOSITORY: target/checkout/target/staging-deploy
14+
15+
steps:
16+
- name: Check if release is running from main
17+
run: |
18+
if [ "${GITHUB_REF}" != "refs/heads/main" ]; then
19+
echo "Release is only allowed from main branch"
20+
exit 1
21+
fi
22+
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Install java
29+
uses: actions/setup-java@v4
30+
with:
31+
java-version: '24'
32+
distribution: 'temurin'
33+
gpg-private-key: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
34+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
35+
cache: 'maven'
36+
37+
- name: Configure git
38+
run: |
39+
git config user.name "Trino Gateway Release"
40+
git config user.email "[email protected]"
41+
42+
- name: Lock branch before release
43+
uses: github/lock@v2
44+
id: release-lock
45+
with:
46+
mode: 'lock'
47+
48+
- name: Run mvn release:prepare
49+
env:
50+
MAVEN_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
51+
run: |
52+
./mvnw -B release:prepare -Poss-release,oss-stage
53+
54+
- name: Determine release version
55+
run: |
56+
export VERSION=$(grep 'scm.tag=' release.properties | cut -d'=' -f2)
57+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
58+
echo "Releasing version: ${VERSION}"
59+
60+
- name: Run mvn release:perform to local staging
61+
env:
62+
MAVEN_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
63+
run: |
64+
./mvnw -B release:perform -Poss-release,oss-stage
65+
66+
- name: Display git status and history, checkout release tag
67+
run: |
68+
git status
69+
git log --oneline -n 2
70+
71+
- name: Run njord:validate
72+
env:
73+
MAVEN_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
74+
MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME }}
75+
MAVENCENTRAL_PASSWORD: ${{ secrets.JRELEASER_NEXUS2_MAVEN_CENTRAL_TOKEN }}
76+
run: |
77+
./mvnw njord:list
78+
./mvnw njord:status
79+
./mvnw njord:validate
80+
81+
- name: Run njord:publish
82+
env:
83+
MAVEN_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
84+
MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME }}
85+
MAVENCENTRAL_PASSWORD: ${{ secrets.JRELEASER_NEXUS2_MAVEN_CENTRAL_TOKEN }}
86+
run:
87+
./mvnw njord:publish -Poss-release,oss-stage -Ddetails -Dfull
88+
89+
- name: Push git changes
90+
run: |
91+
git status
92+
git describe
93+
git push origin main
94+
git push origin --tags
95+
96+
- name: Unlock branch after a release
97+
uses: github/lock@v2
98+
id: release-unlock
99+
with:
100+
mode: 'unlock'

0 commit comments

Comments
 (0)