-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (82 loc) · 3 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: '[ Step ] Publish artifacts with maven'
on:
workflow_call:
inputs:
build_version:
description: 'The version to be published'
type: string
required: true
build_artifact_id:
description: 'The id of the uploaded build artifacts.'
type: string
required: false
default: 'build-artifacts'
env:
BUILD_VERSION: ${{ inputs.build_version }}
jobs:
PublishOnCentral:
name: 'Publish to Maven Central'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: 'maven'
cache-dependency-path: '**/pom.xml'
server-id: 'central'
server-username: 'SERVER_USERNAME'
server-password: 'SERVER_PASSWORD'
- name: (Info) Display build-version
run: echo ${{ inputs.build_version }}
# - name: Download build artifacts
# uses: actions/download-artifact@v4
# with:
# merge-multiple: true
# name: build-artifacts-${{ inputs.build_version }}
- name: Set version
run: ./mvnw versions:set -DnewVersion=${{ inputs.build_version }} -DgenerateBackupPoms=false
- name: Publish to Maven Central
run: ./mvnw -T1C -B -V deploy -Dgpg.signer=bc -DskipTests -Dpublish -Dcentral
env:
SERVER_USERNAME: ${{ secrets.SONATYPE_CENTRAL_USERNAME }}
SERVER_PASSWORD: ${{ secrets.SONATYPE_CENTRAL_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }}
MAVEN_GPG_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GITHUB_DEPENDENCY_GRAPH_ENABLED: false
- name: (Info) Display structure of the files
if: always()
run: tree -D
PublishGitHub:
name: 'Publish to GitHub packages'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: 'maven'
cache-dependency-path: '**/pom.xml'
server-id: 'github'
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-passphrase: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }}
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
name: build-artifacts-${{ inputs.build_version }}
- name: Set version
run: ./mvnw versions:set -DnewVersion=${{ inputs.build_version }} -DgenerateBackupPoms=false
- name: Publish to GitHub
run: ./mvnw -B -V deploy -Dgpg.signer=bc -DskipTests=true -Dpublish -Dgithub
env:
GITHUB_TOKEN: ${{ github.token }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }}
MAVEN_GPG_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GITHUB_DEPENDENCY_GRAPH_ENABLED: false