-
Notifications
You must be signed in to change notification settings - Fork 156
64 lines (53 loc) · 2.08 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Publish to Maven Central
on:
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: main
fetch-depth: 0
- name: Cache Maven
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Setup Java JDK
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
with:
java-version: '11'
distribution: 'microsoft'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.GPG_PRIVATEKEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Configure Git user
run: |
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
- name: Version
id: version
run: |
release_version=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
release_version=${release_version%-*}
echo ::set-output name=version::${release_version}
- name: Release
run: |
export GPG_TTY=$(tty)
./mvnw -Darguments="-Drelease=true" -B release:prepare release:perform -Drelease=true \
-Drepository.url=https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_NAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Git-release
run: |
./mvnw -B versions:set -DnewVersion=${{steps.version.outputs.version}}
./mvnw -B -pl :gctoolkit -Pjreleaser jreleaser:release
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}