-
Notifications
You must be signed in to change notification settings - Fork 11
61 lines (50 loc) · 1.58 KB
/
Copy pathmaven-deploy.yml
File metadata and controls
61 lines (50 loc) · 1.58 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
name: Maven Deploy
on:
push:
tags:
- 'v*'
permissions:
contents: read
concurrency:
group: maven-deploy-${{ github.ref }}
cancel-in-progress: false
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
deploy:
name: maven deploy
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v6
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
cache: maven
java-version: '17'
distribution: 'temurin'
server-id: central # <publishingServerId> in pom.xml
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Validate release tag
run: |
version="$(grep -m1 '<version>' pom.xml | sed -E 's/.*<version>([^<]+)<\/version>.*/\1/')"
tag_version="${GITHUB_REF_NAME#v}"
if [[ "$version" == *-SNAPSHOT ]]; then
echo "Refusing to deploy snapshot version: $version"
exit 1
fi
if [[ "$version" != "$tag_version" ]]; then
echo "Tag version ($tag_version) does not match pom.xml version ($version)"
exit 1
fi
- name: Deploy to Maven Central
run: |
chmod +x ./mvnw
./mvnw -B clean deploy -Dgpg.skip=false --file pom.xml
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}