-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (50 loc) · 1.8 KB
/
gradle-publish.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
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
name: Gradle Package
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Write Secret Key Ring File
uses: joutvhu/write-file@v1
with:
path: secrets/secret-key.gpg
contents: ${{ secrets.GPG_SECRET_KEY_BASE64 }}
write_mode: overwrite
encoding: base64
- name: Write Gradle Properties File
uses: joutvhu/write-file@v1
with:
path: gradle.properties
contents: ${{ secrets.GRADLE_SECRET_PROPERTIES }}
write_mode: overwrite
- name: Build with Gradle
run: gradle clean build
- name: Generate report
run: gradle codeCoverageReport
- name: Upload coverage reports
uses: codecov/codecov-action@v1
with:
files: ./build/reports/jacoco/report.xml
- name: Get Current Release
id: get_current_release
uses: joutvhu/get-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to Sonatype Packages
run: gradle publishMavenPublicationToSonatypeRepository
- name: Publish to GitHub Packages
if: ${{ steps.get_current_release.outputs.prerelease == 'false' && steps.get_current_release.outputs.draft == 'false' }}
run: gradle publishMavenPublicationToGithubRepository