-
-
Notifications
You must be signed in to change notification settings - Fork 4
95 lines (83 loc) · 3.77 KB
/
build.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
name: Build
on:
push:
branches:
- main
tags:
- '**'
pull_request:
branches:
- main
jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
create_staging_repository:
runs-on: ubuntu-latest
needs: [ validation ]
name: Create staging repository
outputs:
repository_id: ${{ steps.create.outputs.repository_id }}
steps:
- id: create
if: startsWith(github.ref, 'refs/tags/')
uses: nexus-actions/create-nexus-staging-repo@v1.1
with:
username: appmattus
password: ${{ secrets.SONATYPE_PASSWORD }}
staging_profile_id: ${{ secrets.SONATYPE_PROFILE_ID }}
description: ${{ github.repository }}/${{ github.workflow }}#${{ github.run_number }}
build:
needs: [ create_staging_repository ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macOS-latest, ubuntu-latest, windows-latest ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- name: Check
run: ./gradlew check
- name: Build
run: ./gradlew build -x check -x lintVitalRelease
- name: Prepare tag properties (*nix)
run: |
echo "${{secrets.GPG_SIGNING_SECRET_KEY_RING_FILE_BASE64}}" > $HOME/.gradle/sonatype-appmattus-keys.gpg.b64
base64 -d $HOME/.gradle/sonatype-appmattus-keys.gpg.b64 > $HOME/.gradle/sonatype-appmattus-keys.gpg
echo "${{secrets.GPG_GRADLE_PROPERTIES}}" > $HOME/.gradle/gradle.properties
if: runner.os != 'Windows' && startsWith(github.ref, 'refs/tags/')
- name: Prepare tag properties (windows)
run: |
echo "${{secrets.GPG_SIGNING_SECRET_KEY_RING_FILE_BASE64}}" > $HOME/.gradle/sonatype-appmattus-keys.gpg.b64
certutil -decode $HOME/.gradle/sonatype-appmattus-keys.gpg.b64 $HOME/.gradle/sonatype-appmattus-keys.gpg
echo "${{secrets.GPG_GRADLE_PROPERTIES}}" > $HOME/.gradle/gradle.properties
if: runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/')
- name: Upload tag
if: startsWith(github.ref, 'refs/tags/')
env:
SONATYPE_REPOSITORY_ID: ${{ needs.create_staging_repository.outputs.repository_id }}
run: ./gradlew publishAllPublicationsToMavenCentral -P"signing.secretKeyRingFile=$(echo $HOME/.gradle/sonatype-appmattus-keys.gpg)"
close:
if: startsWith(github.ref, 'refs/tags/')
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- name: Prepare tag properties (*nix)
run: |
mkdir -p $HOME/.gradle
echo "${{secrets.GPG_SIGNING_SECRET_KEY_RING_FILE_BASE64}}" > $HOME/.gradle/sonatype-appmattus-keys.gpg.b64
base64 -d $HOME/.gradle/sonatype-appmattus-keys.gpg.b64 > $HOME/.gradle/sonatype-appmattus-keys.gpg
echo "${{secrets.GPG_GRADLE_PROPERTIES}}" > $HOME/.gradle/gradle.properties
- name: Close and release tag
run: ./gradlew closeAndReleaseRepository