Skip to content

Commit 1570d17

Browse files
committed
Add release automation
1 parent d582094 commit 1570d17

File tree

3 files changed

+216
-0
lines changed

3 files changed

+216
-0
lines changed

.github/release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- ignore-for-release
5+
categories:
6+
- title: Breaking changes 🛠
7+
labels:
8+
- breaking
9+
- title: Bug fixes 🐛
10+
labels:
11+
- bug
12+
- title: Improvements 🎉
13+
labels:
14+
- improvement
15+
- cleanup
16+
- title: Dependency updates 📦
17+
labels:
18+
- dependency
19+
- title: Security fixes 🔒
20+
labels:
21+
- security
22+
- title: Others
23+
labels:
24+
- "*"

.github/workflows/release.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Release new version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
push:
7+
description: 'Push artifacts to Central and commits to the repository'
8+
required: true
9+
default: true
10+
type: 'boolean'
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
packages: write
18+
env:
19+
STAGED_REPOSITORY: target/checkout/target/staging-deploy
20+
21+
steps:
22+
- name: Check if release is running from master
23+
run: |
24+
if [ "${GITHUB_REF}" != "refs/heads/master" ]; then
25+
echo "Release is only allowed from master branch"
26+
exit 1
27+
fi
28+
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Install java
35+
uses: actions/setup-java@v4
36+
with:
37+
java-version: '23'
38+
distribution: 'temurin'
39+
gpg-private-key: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
40+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
41+
cache: 'maven'
42+
43+
- name: Configure git
44+
run: |
45+
git config user.name "Trino Release"
46+
git config user.email "[email protected]"
47+
48+
- name: Lock branch before release
49+
uses: github/lock@v2
50+
id: release-lock
51+
with:
52+
mode: 'lock'
53+
54+
- name: Run mvn release:prepare
55+
env:
56+
MAVEN_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
57+
run: |
58+
./mvnw -B release:prepare -Poss-release,oss-stage
59+
60+
- name: Determine release version
61+
run: |
62+
export VERSION=$(grep 'scm.tag=' release.properties | cut -d'=' -f2)
63+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
64+
echo "Releasing version: ${VERSION}"
65+
66+
- name: Run mvn release:perform to local staging
67+
env:
68+
MAVEN_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
69+
run: |
70+
./mvnw -B release:perform -Poss-release,oss-stage
71+
72+
- name: Display git status and history
73+
run: |
74+
git status
75+
git log --oneline -n 2
76+
77+
- name: List locally staged artifacts
78+
run: |
79+
find ${{ env.STAGED_REPOSITORY }} -type f
80+
81+
- name: Run JReleaser
82+
uses: jreleaser/release-action@v2
83+
env:
84+
JRELEASER_PROJECT_VERSION: ${{ env.VERSION }}
85+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
JRELEASER_GPG_PUBLIC_KEY: ${{ vars.JRELEASER_GPG_PUBLIC_KEY }}
87+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
88+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
89+
JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME }}
90+
JRELEASER_NEXUS2_MAVEN_CENTRAL_TOKEN: ${{ secrets.JRELEASER_NEXUS2_MAVEN_CENTRAL_TOKEN }}
91+
JRELEASER_NEXUS2_END_STAGE: ${{ inputs.push && 'RELEASE' || 'CLOSE' }}
92+
JRELEASER_SKIP_RELEASE: ${{ inputs.push && 'false' || 'true' }}
93+
with:
94+
setup-java: false
95+
96+
- name: Push git changes
97+
if: ${{ inputs.push }}
98+
run: |
99+
git status
100+
git push origin master
101+
102+
- name: Unlock branch after a release
103+
uses: github/lock@v2
104+
id: release-unlock
105+
with:
106+
mode: 'unlock'
107+
108+
- name: Upload JReleaser logs
109+
if: always()
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: jreleaser-logs
113+
path: |
114+
out/jreleaser/trace.log
115+
out/jreleaser/output.properties

jreleaser.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Hooks that will run on the CI to generate the summary of the steps
2+
hooks:
3+
condition: '"{{ Env.CI }}" == true'
4+
script:
5+
before:
6+
- filter:
7+
includes: ['session']
8+
run: |
9+
echo "### {{command}}" >> $GITHUB_STEP_SUMMARY
10+
echo "| Step | Outcome |" >> $GITHUB_STEP_SUMMARY
11+
echo "| ---- | ------- |" >> $GITHUB_STEP_SUMMARY
12+
success:
13+
- filter:
14+
excludes: ['session']
15+
run: 'echo "| {{event.name}} | :white_check_mark: |" >> $GITHUB_STEP_SUMMARY'
16+
- filter:
17+
includes: ['session']
18+
run: echo "" >> $GITHUB_STEP_SUMMARY
19+
failure:
20+
- filter:
21+
excludes: ['session']
22+
run: 'echo "| {{event.name}} | :x: |" >> $GITHUB_STEP_SUMMARY'
23+
- filter:
24+
includes: ['session']
25+
run: |
26+
echo "" >> $GITHUB_STEP_SUMMARY
27+
echo "### Failure" >> $GITHUB_STEP_SUMMARY
28+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
29+
echo "{{event.stacktrace}}\`\`\`" >> $GITHUB_STEP_SUMMARY
30+
echo "" >> $GITHUB_STEP_SUMMARY
31+
32+
# Project configuration
33+
project:
34+
name: trino-gateway
35+
description: A load balancer, proxy server, and configurable routing gateway
36+
for multiple Trino clusters.
37+
license: Apache-2
38+
java:
39+
groupId: io.trino
40+
multiProject: true
41+
42+
# Ordered as defined in the https://jreleaser.org/guide/latest/concepts/workflow.html#_full_release
43+
signing:
44+
active: ALWAYS
45+
armored: true
46+
47+
# Deploy to OSSRH
48+
deploy:
49+
maven:
50+
pomchecker:
51+
failOnWarning: false # We don't want to fail the build on warnings
52+
failOnError: false # We don't want to fail the build on errors
53+
nexus2:
54+
maven-central:
55+
active: ALWAYS
56+
url: https://oss.sonatype.org/service/local
57+
snapshotUrl: https://oss.sonatype.org/content/repositories/snapshots/
58+
javadocJar: false # Not every module has javadoc (packaging)
59+
closeRepository: true
60+
releaseRepository: true
61+
stagingRepositories:
62+
- target/checkout/target/staging-deploy
63+
64+
# Release to Github
65+
release:
66+
github:
67+
owner: trinodb
68+
overwrite: true # if tag already exists, overwrite it
69+
skipTag: true # created by the release plugin
70+
branch: main
71+
uploadAssets: NEVER
72+
tagName: '{{projectVersion}}'
73+
files: false
74+
draft: false
75+
releaseNotes:
76+
enabled: true
77+
configurationFile: .github/release.yml

0 commit comments

Comments
 (0)