-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (56 loc) · 1.66 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
name: Release
on:
push:
branches:
- main
pull_request: {}
release:
types:
- published
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
trust_level: 4
- name: Setup Java
uses: actions/setup-java@v4
with:
cache: 'maven'
distribution: 'temurin'
java-version: '17'
- name: PR Check
if: github.event_name == 'pull_request'
run: mvn --batch-mode package
- name: Publish package to GitHub Maven Repository
run: mvn --batch-mode deploy
if: github.event_name != 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Upload Release Artifacts'
if: github.event_name == 'release'
run: |
cd ${{ github.workspace }}/target
gh release upload ${{ github.event.release.tag_name }} *.jar*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
- name: Publish package to Maven Central Repository
if: github.event_name == 'release'
run: mvn -P release --batch-mode deploy
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_AUTOPUBLISH: false
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}