-
Notifications
You must be signed in to change notification settings - Fork 251
81 lines (72 loc) · 2.44 KB
/
ci.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
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
jdk:
- 17
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
**/build-cache
!tmp
key: v2-${{ runner.os }}-${{ matrix.jdk }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
v2-${{ runner.os }}-${{ matrix.jdk }}-gradle-
- name: Import snapshot GPG key
run: |
echo "$GPG_SIGNING_KEY_PW" | gpg --batch --import --yes --passphrase-fd 0 <(echo -n "$GPG_SIGNING_KEY" | base64 --decode)
mkdir -p ~/.gradle
echo -n "signing.gnupg.passphrase=${GPG_SIGNING_KEY_PW}" >> ~/.gradle/gradle.properties
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GPG_SIGNING_KEY_PW: ${{ secrets.GPG_SIGNING_KEY_PW }}
if: >-
github.repository == 'KeepSafe/dexcount-gradle-plugin' && github.ref == 'refs/heads/master'
- name: Import random GPG key
run: |
gpg --batch --gen-key <(cat <<EOF
Key-Type: 1
Key-Length: 2048
Key-Usage: sign
Passphrase: foobar
Name-Real: Dexcount Developers
Name-Email: [email protected]
Expire-Date: seconds=1200
%commit
EOF
)
mkdir -p ~/.gradle
echo -n "signing.gnupg.passphrase=foobar" >> ~/.gradle/gradle.properties
if: >-
github.repository != 'KeepSafe/dexcount-gradle-plugin' ||
github.ref != 'refs/heads/master'
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.jdk }}
- name: Build and test
uses: eskatos/gradle-command-action@v1
with:
arguments: check
- name: Deploy snapshot
uses: eskatos/gradle-command-action@v1
with:
arguments: uploadSnapshot
if: >-
github.event_name == 'push' &&
github.repository == 'KeepSafe/dexcount-gradle-plugin' &&
github.ref == 'refs/heads/master'
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}