Skip to content

Commit b7770e5

Browse files
committed
feat: add GitHub Actions workflow for release automation
- Introduced `.github/workflows/release.yml` to automate release processes. - Enabled manual (`workflow_dispatch`) and automatic triggers for `master` branch commits. - Configured Gradle release tasks with required environment variables and secret management. - Integrated signing key handling and OSSRH publication credentials.
1 parent 85a3983 commit b7770e5

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
inputs:
9+
gradle_args:
10+
description: "Extra Gradle args for the release run, for example: --stacktrace --debug"
11+
required: false
12+
default: ""
13+
type: string
14+
15+
permissions:
16+
contents: write
17+
18+
concurrency:
19+
group: release-master
20+
cancel-in-progress: false
21+
22+
jobs:
23+
release:
24+
if: github.event_name == 'workflow_dispatch' || !contains(github.event.head_commit.message, '[Gradle Release Plugin]')
25+
runs-on: ubuntu-latest
26+
27+
env:
28+
GRADLE_OPTS: -Dorg.gradle.daemon=false
29+
EXTRA_GRADLE_ARGS: ${{ github.event.inputs.gradle_args || '' }}
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
37+
38+
- name: Set up JDK 17
39+
uses: actions/setup-java@v4
40+
with:
41+
distribution: temurin
42+
java-version: '17'
43+
44+
- name: Set up Gradle
45+
uses: gradle/actions/setup-gradle@v4
46+
with:
47+
cache-read-only: false
48+
49+
- name: Configure git
50+
run: |
51+
git config user.name "github-actions[bot]"
52+
git config user.email "github-actions[bot]@users.noreply.github.com"
53+
54+
- name: Write signing key
55+
env:
56+
SIGNING_KEY_ASC: ${{ secrets.SIGNING_KEY_ASC }}
57+
run: |
58+
printf '%s' "$SIGNING_KEY_ASC" > "$RUNNER_TEMP/signing-key.asc"
59+
60+
- name: Run release
61+
env:
62+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
63+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
64+
SIGNING_KEY_FILE: ${{ runner.temp }}/signing-key.asc
65+
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
66+
run: |
67+
./gradlew --no-configuration-cache release $EXTRA_GRADLE_ARGS

0 commit comments

Comments
 (0)