Skip to content

Commit ed57c9d

Browse files
committed
github actions: add release workflow
1 parent f59fb20 commit ed57c9d

File tree

3 files changed

+65
-2
lines changed

3 files changed

+65
-2
lines changed

.github/workflows/gradle-build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717

18-
- uses: actions/setup-java@v4
18+
- name: Setup Java
19+
uses: actions/setup-java@v4
1920
with:
2021
distribution: temurin
2122
java-version: ${{ matrix.java }}
23+
cache: gradle
2224

2325
- name: Setup Gradle
2426
uses: gradle/actions/setup-gradle@v4
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release using JReleaser
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version'
8+
required: true
9+
nextVersion:
10+
description: 'Next version after release (-SNAPSHOT will be added automatically)'
11+
required: true
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup Java
23+
uses: actions/setup-java@v4
24+
with:
25+
distribution: temurin
26+
java-version: 21
27+
cache: gradle
28+
29+
- name: Setup Gradle
30+
uses: gradle/actions/setup-gradle@v4
31+
32+
- name: JReleaser full release
33+
env:
34+
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }}
35+
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }}
36+
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }}
37+
JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.JRELEASER_MAVENCENTRAL_TOKEN }}
38+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
39+
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
40+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
41+
run: ./gradlew --console=plain --no-daemon --stacktrace jreleaserFullRelease -Pversion=${{ github.event.inputs.version }}
42+
43+
- name: JReleaser release output
44+
if: always()
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: jreleaser-release
48+
path: |
49+
out/jreleaser/trace.log
50+
out/jreleaser/output.properties
51+
52+
- name: Update version in properties
53+
run: sed -i 's/^version=.*/version=${{ github.event.inputs.nextVersion }}-SNAPSHOT/g' gradle.properties
54+
55+
- name: Commit & Push version update
56+
uses: actions-js/push@master
57+
with:
58+
github_token: ${{ secrets.JRELEASER_GITHUB_TOKEN }}
59+
message: "chore: bump version to ${{ github.event.inputs.nextVersion }}-SNAPSHOT"
60+
tags: true

build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ plugins {
33
id("idea")
44
id("org.jreleaser") version ("1.15.0")
55
id("org.barfuin.gradle.taskinfo") version ("2.2.0") // ./gradlew tiTree jreleaserFullRelease
6+
id("be.vbgn.ci-detect") version ("0.5.0")
67
}
78

89
repositories {
@@ -27,7 +28,7 @@ jreleaser {
2728
signing {
2829
active = org.jreleaser.model.Active.ALWAYS
2930
armored = true
30-
mode = org.jreleaser.model.Signing.Mode.COMMAND
31+
mode = if (ci.isCi) org.jreleaser.model.Signing.Mode.MEMORY else org.jreleaser.model.Signing.Mode.COMMAND
3132
files = true
3233
artifacts = true
3334
checksums = true

0 commit comments

Comments
 (0)