Skip to content

Commit 1cb0f36

Browse files
authored
Add github workflow to auto release to maven central on tags(#439)
1 parent 525055f commit 1cb0f36

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up JDK 1.8
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 1.8
19+
- name: Configure GPG Key and create gradle properties file
20+
run: |
21+
mkdir -p ${HOME}/.gnupg/ ${HOME}/.gradle
22+
23+
# Decode and create the private key file
24+
printf "$GPG_SIGNING_KEY" | base64 --decode > ${HOME}/.gnupg/private.key
25+
chmod 500 ${HOME}/.gnupg/private.key
26+
27+
# Try importing the key.
28+
gpg --batch --import ${HOME}/.gnupg/private.key
29+
30+
# Create the gradle.properties file.
31+
cat > ${HOME}/.gradle/gradle.properties <<EOF
32+
signing.keyId=${GPG_KEY_ID}
33+
signing.secretKeyRingFile=${HOME}/.gnupg/private.key
34+
signing.password=${SIGNING_PASSWORD}
35+
mavenUser=${MAVEN_USERNAME}
36+
mavenPassword=${MAVEN_AUTH_TOKEN}
37+
nexusUsername=${MAVEN_USERNAME}
38+
nexusPassword=${MAVEN_AUTH_TOKEN}
39+
EOF
40+
41+
env:
42+
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
43+
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
44+
SIGNING_PASSWORD: ${{ secrets.GPG_PASSPHRASE }}
45+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
46+
MAVEN_AUTH_TOKEN: ${{ secrets.MAVEN_AUTH_TOKEN }}
47+
48+
- name: Grant execute permission for gradlew
49+
run: chmod +x gradlew
50+
- name: Build with Gradle
51+
run: ./gradlew build
52+
- name: Publish with Gradle
53+
run: ./gradlew publish closeAndReleaseRepository

0 commit comments

Comments
 (0)