-
-
Notifications
You must be signed in to change notification settings - Fork 2
64 lines (51 loc) · 1.87 KB
/
maven-publish.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
64
name: Maven Package
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
env:
artifact_name: interactive-bin-packing
steps:
- uses: actions/checkout@v4
- name: Get the release version
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_OUTPUT
- name: Set up JDK 11 for deploy to OSSRH
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '11'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Update package version
run: mvn versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION }}
- name: Publish to Apache Maven Central
run: mvn deploy -PossrhDeploy
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Set up JDK 11 for deploy to github packages
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '11'
server-id: github
- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -PgithubDeploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload jar files to release as release assets
run: |
TAG=${GITHUB_REF/refs\/tags\//}
gh release upload ${TAG} target/${{ env.artifact_name }}-${{ steps.get_version.outputs.VERSION }}.jar
gh release upload ${TAG} target/${{ env.artifact_name }}-${{ steps.get_version.outputs.VERSION }}-sources.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}