Skip to content

Commit f35c5af

Browse files
committed
added snapshot building
1 parent e0891e8 commit f35c5af

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: build-and-deploy-snapshot
2+
3+
run-name: "build-and-deploy-snapshot [${{ github.ref_name }}]"
4+
5+
on:
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
actions: read
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout develop branch
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Set up JDK 21
24+
uses: actions/setup-java@v4
25+
with:
26+
java-version: '21'
27+
distribution: 'temurin'
28+
cache: 'maven'
29+
server-id: central
30+
server-username: MAVEN_CENTRAL_USERNAME
31+
server-password: MAVEN_CENTRAL_PASSWORD
32+
33+
- name: Get current version
34+
run: |
35+
CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
36+
echo "Current version: $CURRENT_VERSION"
37+
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
38+
39+
- name: Verify SNAPSHOT version
40+
run: |
41+
if [[ ! "$CURRENT_VERSION" =~ -SNAPSHOT$ ]]; then
42+
echo "Error: Version $CURRENT_VERSION is not a SNAPSHOT version"
43+
exit 1
44+
fi
45+
46+
- name: Import GPG key
47+
run: |
48+
echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 --decode | gpg --batch --import
49+
gpg --list-secret-keys --keyid-format LONG
50+
51+
- name: Build and deploy to Maven Central
52+
run: mvn -B -DskipTests clean deploy -Pgpg-ci
53+
env:
54+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
55+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
56+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

0 commit comments

Comments
 (0)