Repository navigation
79 lines (79 loc) · 2.55 KB
/
Copy pathjava-release-template.yml
File metadata and controls
79 lines (79 loc) · 2.55 KB
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
# SPDX-FileCopyrightText: Copyright (C) 2025 Fabrício Barros Cabral
# SPDX-License-Identifier: MIT
---
# yamllint disable rule:line-length
name: java-release-template
'on':
workflow_call:
inputs:
working-directory:
description: "Set the working directory"
required: false
default: "."
type: string
secrets:
RELEASE_KEYNAME:
description: 'GPG key name'
required: true
RELEASE_PASSPHRASE:
description: 'GPG passphrase'
required: true
RELEASE_USERNAME:
description: 'Sonatype username'
required: true
RELEASE_PASSWORD:
description: 'Sonatype password'
required: true
defaults:
run:
shell: bash -xeuo pipefail {0}
permissions:
actions: read
security-events: write
contents: read
jobs:
java-build-template:
uses: fabriciofx/github-workflows/.github/workflows/java-build-template.yml@main
java-release-template:
runs-on: ubuntu-24.04
needs: java-build-template
steps:
- name: Setup Maven settings.xml
working-directory: ${{ inputs.working-directory }}
run: |
mkdir -p ~/.m2
cat > ~/.m2/settings.xml <<EOF
<settings>
<profiles>
<profile>
<id>app</id>
<properties>
<gpg.keyname>"${{ secrets.RELEASE_KEYNAME }}"</gpg.keyname>
<gpg.passphrase>"${{ secrets.RELEASE_PASSPHRASE }}"</gpg.passphrase>
</properties>
</profile>
</profiles>
<servers>
<server>
<id>oss.sonatype.org</id>
<username>"${{ secrets.RELEASE_USERNAME }}"</username>
<password>"${{ secrets.RELEASE_PASSWORD }}"</password>
</server>
</servers>
</settings>
EOF
- name: Release to Sonatype (Maven Central)
working-directory: ${{ inputs.working-directory }}
run: |
[[ -x "mvnw" ]] && mvn="./mvnw" || mvn="mvn"
args=(--errors --batch-mode deploy -Psonatype -Papp -DskipTests=true)
profile=$(grep -q "<id>qulice</id>" pom.xml && echo "-Pqulice")
[[ -n "${profile}" ]] && args+=("${profile}")
${mvn} "${args[@]}"
env:
GPG_TTY: $(tty)
JDK_JAVA_OPTIONS: >
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.io=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
--add-opens java.base/java.util.concurrent=ALL-UNNAMED