-
Notifications
You must be signed in to change notification settings - Fork 13
121 lines (116 loc) · 4.6 KB
/
release.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: build and publish a release
on:
release:
types: [published]
jobs:
create-staging-repository:
name: Create staging repository
runs-on: ubuntu-latest
outputs:
repository_id: ${{ steps.create.outputs.repository_id }}
steps:
- id: create
uses: nexus-actions/[email protected]
with:
base_url: https://s01.oss.sonatype.org/service/local/
username: ${{ secrets.SONATYPE_USERNAME }}
password: ${{ secrets.SONATYPE_PASSWORD }}
staging_profile_id: ${{ secrets.SONATYPE_PROFILE_ID }}
description: ${{ github.repository }}/${{ github.workflow }}#${{ github.run_number }}
build-upload:
needs: create-staging-repository
runs-on: ${{ matrix.os }}
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.PGP_SIGNING_KEY }}
GPG_PRIVATE_PASSWORD: ${{ secrets.PGP_SIGNING_PASSWORD }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- name: Check out
uses: actions/checkout@v2
- name: Cached Konan
uses: actions/cache@v2
with:
path: ~/.konan
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-konan-
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
# Host only for MacOS / Windows
- name: Check (macos / windows)
if: matrix.os != 'ubuntu-latest'
run: ./gradlew --stacktrace hostOnlyTest
shell: bash
# Linux / JVM / JS
- name: Check (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: ./gradlew --stacktrace check
shell: bash
- name: Publish To Maven Local (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: ./gradlew --stacktrace publishToMavenLocal
shell: bash
- name: Check plugin with JVM JUnit4 (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-jvm-junit4
run: ../../gradlew --stacktrace check
shell: bash
- name: Check plugin with JVM JUnit5 (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-jvm-junit5
run: ../../gradlew --stacktrace check
shell: bash
- name: Check plugin with Android (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-android
run: ../../gradlew --stacktrace check
shell: bash
- name: Upload (macos / windows)
if: matrix.os != 'ubuntu-latest'
run: ./gradlew --stacktrace hostOnlyPublish -Porg.kodein.sonatype.repositoryId=${{ needs.create-staging-repository.outputs.repository_id }}
shell: bash
- name: Upload (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: ./gradlew --stacktrace publishAllPublicationsToOssrhStagingRepository -Porg.kodein.sonatype.repositoryId=${{ needs.create-staging-repository.outputs.repository_id }}
shell: bash
drop-or-release:
needs: [create-staging-repository, build-upload]
runs-on: ubuntu-latest
if: ${{ always() && needs.create-staging-repository.result == 'success' }}
steps:
- name: Discard
if: ${{ needs.build-upload.result != 'success' }}
uses: nexus-actions/drop-nexus-staging-repo@v1
with:
base_url: https://s01.oss.sonatype.org/service/local/
username: ${{ secrets.SONATYPE_USERNAME }}
password: ${{ secrets.SONATYPE_PASSWORD }}
staging_repository_id: ${{ needs.create-staging-repository.outputs.repository_id }}
- name: Release
if: ${{ needs.build-upload.result == 'success' }}
uses: nexus-actions/release-nexus-staging-repo@v1
with:
base_url: https://s01.oss.sonatype.org/service/local/
username: ${{ secrets.SONATYPE_USERNAME }}
password: ${{ secrets.SONATYPE_PASSWORD }}
staging_repository_id: ${{ needs.create-staging-repository.outputs.repository_id }}
gradle-plugin:
runs-on: ubuntu-latest
needs: [build-upload, drop-or-release]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Publish
env:
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
run: ./gradlew publishPlugins