-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (55 loc) · 1.89 KB
/
release.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
name: Release
on:
workflow_dispatch:
inputs:
skip-deploy-maven-central:
description: "Skip deployment to Maven Central"
required: true
type: boolean
default: false
jobs:
release:
runs-on: ubuntu-latest
defaults:
run:
shell: "bash"
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
permissions:
contents: write # Required for creating GitHub release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fail if not running on main branch
if: ${{ github.ref != 'refs/heads/main' }}
uses: actions/github-script@v7
with:
script: |
core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main')
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 17
cache: "maven"
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Build
run: mvn --batch-mode -T 1C clean install
- name: List secret GPG keys
run: gpg --list-secret-keys
- name: Publish to Maven Central Repository
if: ${{ !inputs.skip-deploy-maven-central }}
run: mvn --batch-mode deploy -Possrh -DstagingDescription="Deployed via GitHub workflow release.yml"
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
- name: Create GitHub Release
run: ./.github/workflows/github_release.sh
env:
GH_TOKEN: ${{ github.token }}