This repository was archived by the owner on Jun 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (92 loc) · 3.5 KB
/
gradle.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
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
103
104
105
106
name: Gradle
on:
pull_request:
branches: [ v1.* ]
push:
branches: [ v1.* ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Restore caches
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle', '**/*.gradle*', 'gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle', '**/*.gradle*' ,'gradle-wrapper.properties') }}
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# - name: Build with Gradle
# run: ./gradlew build -x test
# - name: Run unit tests
# run: ./gradlew test
- name: Get merged pull request
uses: actions-ecosystem/action-get-merged-pull-request@v1.0.1
if: github.event_name == 'push'
id: pr
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Get release label
uses: actions-ecosystem/action-release-label@v1
if: ${{ steps.pr.outputs.labels != null }}
id: release-label
with:
label_prefix: 'release/'
labels: ${{ steps.pr.outputs.labels }}
- name: Get latest tag
uses: actions-ecosystem/action-get-latest-tag@v1
if: ${{ steps.release-label.outputs.level != null }}
id: get-latest-tag
with:
semver_only: true
- name: Bump version
uses: actions-ecosystem/action-bump-semver@v1
if: ${{ steps.release-label.outputs.level != null }}
id: bump-semver
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: ${{ steps.release-label.outputs.level }}
- name: Push tag
uses: actions-ecosystem/action-push-tag@v1
if: ${{ steps.bump-semver.outputs.new_version != null }}
with:
tag: ${{ steps.bump-semver.outputs.new_version }}
message: '${{ steps.bump-semver.outputs.new_version }}: PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}'
- name: Store Private key
uses: DamianReeves/write-file-action@v1.0
if: ${{ steps.bump-semver.outputs.new_version != null }}
with:
path: private.key
contents: ${{ secrets.PRIV_KEY }}
write-mode: overwrite
- name: Publish
if: ${{ steps.bump-semver.outputs.new_version != null }}
env:
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGN_KEY: ${{ secrets.PRIV_KEY_PASS }}
run: |
mkdir -p $HOME/.gnupg
echo use-agent >> $HOME/.gnupg/gpg.conf
echo pinentry-mode loopback >> $HOME/.gnupg/gpg.conf
echo allow-loopback-pinentry >> $HOME/.gnupg/gpg-agent.conf
gpg --batch --import private.key
gpg --batch --export-secret-keys --passphrase $SIGN_KEY "Sebastiaan de Schaetzen <sebastiaan.de.schaetzen@gmail.com>" > private.gpg
NEW_VERSION=$(echo ${{ github.event.push.ref }} | 's:refs/tags/v::')
./gradlew publishMockBukkitPublicationToRepositoryRepository \
-Pmockbukkit.version=$NEW_VERSION \
-PossrhUsername=seeseemelk \
-PossrhPassword=$OSSRH_PASSWORD \
-Psigning.secretKeyRingFile=private.gpg \
-Psigning.keyId=${{ secrets.PRIV_KEY_ID }} \
-Psigning.password=$SIGN_KEY