-
Notifications
You must be signed in to change notification settings - Fork 1.6k
66 lines (54 loc) · 1.7 KB
/
release.yml
File metadata and controls
66 lines (54 loc) · 1.7 KB
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
65
66
name: Release
on:
push:
branches:
- main
workflow_dispatch:
inputs:
snapshot:
description: 'Deploy SNAPSHOT'
type: boolean
default: false
permissions:
contents: read
jobs:
deploy:
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: 'corretto'
java-version: '11'
- name: Grant Permission
run: chmod +x ./mvnw
- name: Validate SNAPSHOT version
if: inputs.snapshot == true
run: |
VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
if [[ "$VERSION" != *-SNAPSHOT ]]; then
echo "::error::Version $VERSION is not a SNAPSHOT version"
exit 1
fi
- name: Remove old Maven Settings
run: rm -f /home/runner/.m2/settings.xml
- name: Maven Settings
uses: s4u/maven-settings-action@v4.0.0
with:
servers: |
[{
"id": "central",
"username": "${{ secrets.OSSRH_USERNAME }}",
"password": "${{ secrets.OSSRH_PASSWORD }}"
}]
- name: Import GPG
uses: crazy-max/ghaction-import-gpg@v7.0.0
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Deploy
env:
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: ./mvnw -B -ntp deploy -DskipTests -Dgpg.keyname=${GPG_KEY_NAME} -Dgpg.passphrase=${GPG_PASSPHRASE}