-
-
Notifications
You must be signed in to change notification settings - Fork 221
54 lines (43 loc) · 1.9 KB
/
publish-release.yaml
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
name: Publish Release
on:
push:
branches:
- 'wip-[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set Build Number Environment Variable
env:
BUILD_NUMBER_OFFSET: 26
run: |
echo "BUILD_NUMBER=$((${{ github.run_number }}+$BUILD_NUMBER_OFFSET))" >> $GITHUB_ENV
- name: Install gpg secret key
run: |
cat <(echo -e "${{ secrets.GPG_SECRET_KEY }}") | gpg2 --batch --import
gpg2 --list-secret-keys --keyid-format LONG
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'zulu'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build and Test
run: ./gradlew clean check
- name: Publish WIP to Github Packages
if: ${{ contains( github.ref, 'wip-' ) }}
env:
GRADLE_OPTS: -Dbuild.number=$BUILD_NUMBER -Dbuild.vcs.number=${{ github.sha }} -Dbuild.vcs.branch=${{ github.ref }}
GPR_USERNAME: ${{ github.actor }}
GPR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew publishAllPublicationsToGitHubPackagesRepository -Psigning.gnupg.keyName=${{ secrets.GPG_SECRET_KEY_ID }} -Psigning.gnupg.passphrase=${{ secrets.GPG_SECRET_KEY_PASSWORD }}
- name: Publish Release to Maven Central
if: ${{ !contains( github.ref, 'wip-' ) }}
env:
GRADLE_OPTS: -Dbuild.number=$BUILD_NUMBER -Dbuild.vcs.number=${{ github.sha }} -Dbuild.vcs.branch=${{ github.ref }}
MCR_USERNAME: ${{ secrets.MCR_USERNAME }}
MCR_PASSWORD: ${{ secrets.MCR_PASSWORD }}
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -Psigning.gnupg.keyName=${{ secrets.GPG_SECRET_KEY_ID }} -Psigning.gnupg.passphrase=${{ secrets.GPG_SECRET_KEY_PASSWORD }}