Skip to content

Commit af8c4c1

Browse files
committed
Add snapshot and release workflows
1 parent 885bba3 commit af8c4c1

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

.github/workflows/snapshot.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Publish Snapshot
2+
on:
3+
push:
4+
branches:
5+
- master
6+
workflow_dispatch:
7+
8+
jobs:
9+
snapshot:
10+
name: Deploy Snapshot
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up publishing to maven central
15+
uses: actions/setup-java@v4
16+
with:
17+
java-version: '8'
18+
distribution: 'temurin'
19+
cache: 'maven'
20+
server-id: ossrh
21+
server-username: MAVEN_USERNAME
22+
server-password: MAVEN_PASSWORD
23+
- name: mvn offline
24+
run: |
25+
mvn -q dependency:go-offline
26+
- name: deploy
27+
run: |
28+
mvn --no-transfer-progress -DskipTests deploy
29+
env:
30+
MAVEN_USERNAME: ${{secrets.OSSRH_USER}}
31+
MAVEN_PASSWORD: ${{secrets.OSSRH_PASSWORD}}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
on:
3+
release:
4+
types: [published]
5+
workflow_dispatch:
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout sources
12+
uses: actions/checkout@v4
13+
14+
- name: Set up Java with Maven cache
15+
16+
uses: actions/setup-java@v4
17+
with:
18+
java-version: '8'
19+
distribution: 'temurin'
20+
cache: 'maven'
21+
server-id: ossrh
22+
server-username: MAVEN_USERNAME
23+
server-password: MAVEN_PASSWORD
24+
25+
- name: Update version in Maven configuration
26+
run: |
27+
mvn --no-transfer-progress \
28+
--batch-mode \
29+
versions:set -DnewVersion=${{ github.event.release.tag_name }}
30+
if: ${{ github.event.release.tag_name }}
31+
32+
- name: Install GPG key
33+
34+
run: |
35+
cat <(echo -e "${{ secrets.OSSH_GPG_SECRET_KEY }}") | gpg --batch --import
36+
gpg --list-secret-keys --keyid-format LONG
37+
38+
- name: Publish to Maven
39+
40+
run: |
41+
mvn --no-transfer-progress \
42+
--batch-mode \
43+
-Dgpg.passphrase='${{ secrets.OSSH_GPG_SECRET_KEY_PASSWORD }}' \
44+
-DskipTests deploy
45+
46+
env:
47+
MAVEN_USERNAME: ${{secrets.OSSRH_USER}}
48+
MAVEN_PASSWORD: ${{secrets.OSSRH_PASSWORD}}

0 commit comments

Comments
 (0)