-
-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (102 loc) · 4.58 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
on:
push:
tags:
- v*
name: Release to Maven Central
jobs:
create_staging_repository:
runs-on: ubuntu-latest
name: Create staging repository
outputs:
repository_id: ${{ steps.create.outputs.repository_id }}
steps:
- id: create
uses: nexus-actions/create-nexus-staging-repo@3e5e7209801629febdcf75541a4898710d28df9a # v1.2
with:
username: ${{ secrets.NEXUS_PUBLISH_USERNAME }}
password: ${{ secrets.NEXUS_PUBLISH_PASSWORD }}
staging_profile_id: ${{ secrets.NEXUS_PUBLISH_STAGING_PROFILE_ID }}
description: ${{ github.repository }}/${{ github.workflow }}#${{ github.run_number }}
publish:
runs-on: macos-latest
needs: create_staging_repository
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up JDK
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
with:
distribution: temurin
java-version: 11
- name: Cache Kotlin/Native compiler
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'gradle/libs.versions.toml') }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4
with:
gradle-home-cache-cleanup: true
cache-read-only: true
add-job-summary: always
validate-wrappers: true
- name: Publish
shell: bash
run: ./gradlew publishAllPublicationsToSonatypeRepository -PenableNativeTargets
env:
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.NEXUS_PUBLISH_GPG_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.NEXUS_PUBLISH_GPG_KEY_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }}
SONATYPE_REPOSITORY_ID: ${{ needs.create_staging_repository.outputs.repository_id }}
publish_windows:
runs-on: windows-latest
needs: create_staging_repository
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up JDK
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
with:
distribution: temurin
java-version: 11
- name: Cache Kotlin/Native compiler
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'gradle/libs.versions.toml') }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4
with:
gradle-home-cache-cleanup: true
cache-read-only: true
add-job-summary: always
validate-wrappers: true
- name: Publish Windows artifacts
shell: bash
run: ./gradlew publishMingwX64PublicationToSonatypeRepository -PenableNativeTargets
env:
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.NEXUS_PUBLISH_GPG_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.NEXUS_PUBLISH_GPG_KEY_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }}
SONATYPE_REPOSITORY_ID: ${{ needs.create_staging_repository.outputs.repository_id }}
finalize:
runs-on: ubuntu-latest
needs: [create_staging_repository, publish, publish_windows]
if: ${{ always() && needs.create_staging_repository.result == 'success' }}
steps:
- name: Discard
if: ${{ needs.publish.result != 'success' || needs.publish_windows.result != 'success' }}
uses: nexus-actions/drop-nexus-staging-repo@fe83783967a063540320ace3c8942608246705a1 # v1
with:
username: ${{ secrets.NEXUS_PUBLISH_USERNAME }}
password: ${{ secrets.NEXUS_PUBLISH_PASSWORD }}
staging_repository_id: ${{ needs.create_staging_repository.outputs.repository_id }}
- name: Release
if: ${{ needs.publish.result == 'success' && needs.publish_windows.result == 'success' }}
uses: nexus-actions/release-nexus-staging-repo@36161f25ef98cc3821eabb11ab742d2e9d479e52 # v1.2
with:
username: ${{ secrets.NEXUS_PUBLISH_USERNAME }}
password: ${{ secrets.NEXUS_PUBLISH_PASSWORD }}
staging_repository_id: ${{ needs.create_staging_repository.outputs.repository_id }}