-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (87 loc) · 3.08 KB
/
release.yml
File metadata and controls
102 lines (87 loc) · 3.08 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Release
on:
release:
types:
- published
workflow_dispatch:
inputs:
version:
description: Maven release version, for example 1.0.0
required: true
type: string
auto_publish:
description: Publish automatically after Central Portal validation
required: true
default: true
type: boolean
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
maven-central:
name: Publish to Maven Central
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Resolve release version
id: release
shell: bash
env:
RELEASE_INPUT: ${{ github.event.inputs.version }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
AUTO_PUBLISH_INPUT: ${{ github.event.inputs.auto_publish }}
run: |
version="${RELEASE_INPUT:-${RELEASE_TAG:-${GITHUB_REF_NAME}}}"
version="${version#v}"
if [[ -z "$version" ]]; then
echo "Could not resolve a Maven release version." >&2
exit 1
fi
if [[ ! "$version" =~ ^[0-9]+(\.[0-9]+){2}([.-][0-9A-Za-z.-]+)?$ ]]; then
echo "Release version '$version' does not look like a Maven release version." >&2
exit 1
fi
auto_publish="${AUTO_PUBLISH_INPUT:-true}"
wait_until="validated"
if [[ "$auto_publish" == "true" ]]; then
wait_until="published"
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "auto_publish=$auto_publish" >> "$GITHUB_OUTPUT"
echo "wait_until=$wait_until" >> "$GITHUB_OUTPUT"
- name: Set up JDK 21 and Maven Central credentials
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '21'
cache: maven
server-id: central
server-username: CENTRAL_USERNAME
server-password: CENTRAL_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Set Maven release version
run: >
mvn --batch-mode --no-transfer-progress
org.codehaus.mojo:versions-maven-plugin:2.17.1:set
-DnewVersion=${{ steps.release.outputs.version }}
-DgenerateBackupPoms=false
- name: Verify SDK before publishing
run: mvn --batch-mode --no-transfer-progress verify
- name: Compile examples
run: scripts/validate-examples.sh
- name: Publish to Maven Central
env:
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
run: >
mvn --batch-mode --no-transfer-progress
-P release
-DskipTests
-Dcentral.publish.auto=${{ steps.release.outputs.auto_publish }}
-Dcentral.publish.waitUntil=${{ steps.release.outputs.wait_until }}
deploy