Skip to content

Commit 2639655

Browse files
committed
build: Update GH workflows
1 parent b810a7c commit 2639655

File tree

3 files changed

+33
-131
lines changed

3 files changed

+33
-131
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,9 @@ name: Build
2121
on:
2222
pull_request:
2323

24-
env:
25-
JAVA_VERSION: '11'
26-
JAVA_DISTRO: 'zulu'
27-
2824
jobs:
2925
build:
30-
name: Build
31-
runs-on: ubuntu-latest
3226
if: startsWith(github.event.head_commit.message, 'Releasing version') != true
33-
34-
steps:
35-
- uses: actions/checkout@v4
36-
37-
- name: Setup Java
38-
uses: actions/setup-java@v4
39-
with:
40-
java-version: ${{ env.JAVA_VERSION }}
41-
distribution: ${{ env.JAVA_DISTRO }}
42-
cache: gradle
43-
44-
- name: Build
45-
run: ./gradlew build -S
27+
uses: kordamp/kordamp-workflows/.github/workflows/gradle-build.yml@main
28+
with:
29+
java-version: 11

.github/workflows/early-access.yml

Lines changed: 11 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -22,56 +22,17 @@ on:
2222
push:
2323
branches: [ master ]
2424

25-
env:
26-
JAVA_VERSION: '11'
27-
JAVA_DISTRO: 'zulu'
28-
2925
jobs:
3026
earlyaccess:
31-
name: EarlyAccess
27+
name: 'Early Access'
3228
if: github.repository == 'kordamp/json-lib' && startsWith(github.event.head_commit.message, 'Releasing version') != true
33-
runs-on: ubuntu-latest
34-
steps:
35-
- name: Checkout
36-
uses: actions/checkout@v4
37-
with:
38-
fetch-depth: 0
39-
40-
- name: Cancel previous run
41-
uses: styfle/[email protected]
42-
with:
43-
access_token: ${{ secrets.GITHUB_TOKEN }}
44-
45-
- name: Setup Java
46-
uses: actions/setup-java@v4
47-
with:
48-
java-version: ${{ env.JAVA_VERSION }}
49-
distribution: ${{ env.JAVA_DISTRO }}
50-
cache: gradle
51-
52-
- name: Build
53-
run: ./gradlew -Prelease=true build -S
54-
55-
- name: Version
56-
id: vars
57-
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT
58-
59-
- name: Release
60-
uses: jreleaser/release-action@v2
61-
with:
62-
arguments: release
63-
env:
64-
JRELEASER_PROJECT_VERSION: ${{ steps.vars.outputs.version }}
65-
JRELEASER_GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
66-
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
67-
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
68-
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
69-
70-
- name: JReleaser output
71-
if: always()
72-
uses: actions/upload-artifact@v4
73-
with:
74-
name: artifact
75-
path: |
76-
out/jreleaser/trace.log
77-
out/jreleaser/output.properties
29+
uses: kordamp/kordamp-workflows/.github/workflows/gradle-early-access.yml@main
30+
with:
31+
java-version: 11
32+
secrets:
33+
github-token: ${{ secrets.GIT_ACCESS_TOKEN }}
34+
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
35+
gpg-public-key: ${{ secrets.GPG_PUBLIC_KEY }}
36+
gpg-secret-key: ${{ secrets.GPG_SECRET_KEY }}
37+
maven-username: ${{ secrets.SONATYPE_USERNAME }}
38+
maven-password: ${{ secrets.SONATYPE_PASSWORD }}

.github/workflows/release.yml

Lines changed: 19 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -22,70 +22,27 @@ on:
2222
workflow_dispatch:
2323
inputs:
2424
version:
25-
description: "Release version"
25+
description: 'Release version'
26+
required: true
27+
branch:
28+
description: 'Branch'
29+
default: 'master'
2630
required: true
27-
28-
env:
29-
JAVA_VERSION: '11'
30-
JAVA_DISTRO: 'zulu'
3131

3232
jobs:
3333
release:
3434
name: Release
35-
runs-on: ubuntu-latest
36-
steps:
37-
- uses: actions/checkout@v4
38-
with:
39-
fetch-depth: 0
40-
41-
- name: Cancel previous run
42-
uses: styfle/[email protected]
43-
with:
44-
access_token: ${{ secrets.GITHUB_TOKEN }}
45-
46-
- name: Set up Java
47-
uses: actions/setup-java@v4
48-
with:
49-
java-version: ${{ env.JAVA_VERSION }}
50-
distribution: ${{ env.JAVA_DISTRO }}
51-
cache: gradle
52-
53-
- name: Version
54-
id: vars
55-
shell: bash
56-
run: |
57-
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
58-
echo ${{ github.event.inputs.version }} > VERSION
59-
git add VERSION
60-
sed -i -e "s/^\:project-version\:\ .*/:project-version: ${{ github.event.inputs.version }}/g" README.adoc
61-
git config --global user.email "${{ secrets.COMMIT_EMAIL }}"
62-
git config --global user.name "Andres Almiray"
63-
git commit -a -m "Releasing version ${{ github.event.inputs.version }}"
64-
git push origin master
65-
66-
- name: Deploy
67-
run: |
68-
./gradlew -Pprofile=sbom -PreproducibleBuild=true publish -S
69-
70-
- name: Release
71-
uses: jreleaser/release-action@v2
72-
with:
73-
arguments: full-release
74-
env:
75-
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }}
76-
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77-
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
78-
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
79-
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
80-
JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
81-
JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
82-
JRELEASER_MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
83-
84-
- name: JReleaser output
85-
if: always()
86-
uses: actions/upload-artifact@v4
87-
with:
88-
name: artifact
89-
path: |
90-
out/jreleaser/trace.log
91-
out/jreleaser/output.properties
35+
uses: kordamp/kordamp-workflows/.github/workflows/gradle-release.yml@main
36+
with:
37+
branch: ${{ github.event.inputs.branch }}
38+
version: ${{ github.event.inputs.version }}
39+
java-version: 11
40+
secrets:
41+
github-token: ${{ secrets.GIT_ACCESS_TOKEN }}
42+
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
43+
gpg-public-key: ${{ secrets.GPG_PUBLIC_KEY }}
44+
gpg-secret-key: ${{ secrets.GPG_SECRET_KEY }}
45+
gpg-key-id: ${{ secrets.GPG_KEY_ID }}
46+
maven-username: ${{ secrets.SONATYPE_USERNAME }}
47+
maven-password: ${{ secrets.SONATYPE_PASSWORD }}
48+
mastodon-access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }}

0 commit comments

Comments
 (0)