-
Notifications
You must be signed in to change notification settings - Fork 13
62 lines (54 loc) · 2.23 KB
/
release.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
name: Release
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 5
- name: Configure GIT
run: |
git config --global user.name "Gluon Bot"
git config --global user.email "githubbot@gluonhq.com"
- name: Setup Java 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Import GPG keys
run: |
gpg --import --batch <(echo "$GPG_PRIVATE_KEY") &> /dev/null
# Gradle doesn't support GPG 2.1 and later: https://github.com/gradle/gradle/issues/888
gpg --export-secret-keys --pinentry-mode loopback --passphrase="$GPG_PASSPHRASE" > ~/.gnupg/secring.gpg
rm -rf /tmp/secret
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Deploy to Sonatype Nexus
id: deploy
run: |
./gradlew clean build uploadPublished -i -PsonatypeUsername=$SONATYPE_USERNAME -PsonatypePassword=$SONATYPE_PASSWORD -Psigning.keyId=$GPG_KEYNAME -Psigning.password=$GPG_PASSPHRASE -Psigning.secretKeyRingFile=$HOME/.gnupg/secring.gpg
echo ::set-output name=exit_code::$?
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }}
- name: Commit next development version
if: steps.deploy.outputs.exit_code == 0
run: |
TAG=${GITHUB_REF/refs\/tags\//}
newVersion=${TAG%.*}.$((${TAG##*.} + 1)) # Update version by 1
sed -i "s/^version = '.*'$/version = '$newVersion-SNAPSHOT'/g" build.gradle
git commit build.gradle -m "New development version: $newVersion"
git push https://gluon-bot:$GLUONBOT_PASSWORD@github.com/$GITHUB_REPOSITORY HEAD:master
env:
GITHUB_PASSWORD: ${{ secrets.GLUONBOT_PASSWORD }}