Skip to content

Commit ff19562

Browse files
authored
Create publish-to-maven-central.yml
1 parent bbd0124 commit ff19562

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to publish (e.g., 3.0.0)'
8+
required: true
9+
type: string
10+
11+
permissions:
12+
actions: read
13+
contents: read
14+
id-token: write
15+
16+
jobs:
17+
publish:
18+
if: github.event.sender.site_admin == true
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Set up JDK
25+
uses: actions/setup-java@v4
26+
with:
27+
distribution: 'temurin'
28+
java-version: '21'
29+
30+
- name: Prepare root gradle.properties
31+
run: |
32+
echo "mavenCentralUsername=${{ secrets.MAVEN_CENTRAL_USERNAME }}" >> gradle.properties
33+
echo "mavenCentralPassword=${{ secrets.MAVEN_CENTRAL_PASSWORD }}" >> gradle.properties
34+
echo "signing.password=${{ secrets.SIGNING_PASSWORD }}" >> gradle.properties
35+
echo "signing.keyId=${{ secrets.SIGNING_KEY_ID }}" >> gradle.properties
36+
echo "signing.secretKeyRingFile=secring.gpg" >> gradle.properties
37+
38+
# Write secret keyring file
39+
echo "${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}" | base64 -d > secring.gpg
40+
41+
- name: Set VERSION_NAME in library/gradle.properties
42+
run: |
43+
if grep -q "^VERSION_NAME=" library/gradle.properties; then
44+
sed -i "s/^VERSION_NAME=.*/VERSION_NAME=${{ github.event.inputs.version }}/" library/gradle.properties
45+
else
46+
echo "VERSION_NAME=${{ github.event.inputs.version }}" >> library/gradle.properties
47+
fi
48+
- name: Run publish and release
49+
run: ./gradlew :library:publishAndReleaseToMavenCentral --no-configuration-cache

0 commit comments

Comments
 (0)