-
-
Notifications
You must be signed in to change notification settings - Fork 129
63 lines (61 loc) · 2.48 KB
/
mavenCentral_cd.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: Maven Central Continuous Delivery
# Executed automatically when a new PR is merged to master, if the release number already exists this job will fail
# This pipeline will build from main, upload the artifacts, and create the GitHub release
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
build_release_and_deliver:
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
check-latest: true
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
# Captures the engine version from the pom.xml
- name: Set Release Version Number
run: |
echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
# Attempt to create a GitHub release using the version in the pom.xml, if this release already exists, this job will fail fast
- name: Create GitHub Release
id: create_release
uses: ncipollo/release-action@v1.12.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
allowUpdates: false
generateReleaseNotes: true
name: ${{ env.RELEASE_VERSION }}
tag: ${{ env.RELEASE_VERSION }}
# - uses: s4u/maven-settings-action@v2.8.0
# with:
# servers: |
# [{
# "id": "ossrh",
# "username": "${{ secrets.OSSRH_USERNAME }}",
# "password": "${{ secrets.OSSRH_PASSWORD }}"
# }]
- name: Setup Prerequisites
run: |
git config --global user.signingKey ${{ secrets.GPG_KEYNAME }}
git config --global commit.gpgsign true
gpg --version
gpgconf --kill gpg-agent
gpg -K --keyid-format SHORT
export GPG_TTY=$(tty)
- name: Deploy SHAFT to maven central
continue-on-error: true
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: mvn --batch-mode deploy "-DskipTests" "-Dgpg.keyname=${{secrets.GPG_KEYNAME}}" "-Dgpg.passphrase=${{secrets.GPG_PASSPHRASE}}"