-
Notifications
You must be signed in to change notification settings - Fork 1
170 lines (163 loc) · 7.16 KB
/
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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: Build Artifacts for Publishing
on:
workflow_dispatch:
push:
branches:
- master
tags:
- 'v*'
env:
# GPG signature credentials
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
# Solo Studios maven repo credentials
ORG_GRADLE_PROJECT_SoloStudiosUsername: ${{ secrets.SOLO_STUDIOS_USERNAME }}
ORG_GRADLE_PROJECT_SoloStudiosPassword: ${{ secrets.SOLO_STUDIOS_PASSWORD }}
# Sonatype maven repo credentials
ORG_GRADLE_PROJECT_SonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_SonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
JAVA_VERSION: 17
JAVA_DISTRIBUTION: temurin
jobs:
create-staging-repo:
name: Create Sonatype Staging Repository
runs-on: ubuntu-latest
outputs:
repository-id: ${{ steps.create.outputs.repository_id }}
steps:
- name: Create Staging Repository
id: create
uses: nexus-actions/create-nexus-staging-repo@3e5e7209801629febdcf75541a4898710d28df9a
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 }}
publish-windows:
name: Publish Windows Artifacts
runs-on: windows-latest
needs: [ create-staging-repo ]
env:
ORG_GRADLE_PROJECT_repositoryId: ${{ needs.create-staging-repo.outputs.repository-id }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-tags: true
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: "${{ env.JAVA_VERSION }}"
distribution: "${{ env.JAVA_DISTRIBUTION }}"
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Publish MinGW artifacts to solo studios
run: |
./gradlew publishMingwX64PublicationToSoloStudiosRepository
- name: Publish MinGW artifacts to Sonatype
if: startsWith(github.ref, 'refs/tags') # Only publish to sonatype if tagged
run: |
./gradlew publishMingwX64PublicationToSonatypeRepository
publish-mac:
name: Publish macOS artifacts
runs-on: macos-latest
needs: [ create-staging-repo ]
env:
ORG_GRADLE_PROJECT_repositoryId: ${{ needs.create-staging-repo.outputs.repository-id }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-tags: true
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: "${{ env.JAVA_VERSION }}"
distribution: "${{ env.JAVA_DISTRIBUTION }}"
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Publish MacOS/iOS/TvOS/WatchOS artifacts to solo studios
run: |
./gradlew \
publishMacosX64PublicationToSoloStudiosRepository \
publishMacosArm64PublicationToSoloStudiosRepository \
publishIosArm64PublicationToSoloStudiosRepository \
publishIosX64PublicationToSoloStudiosRepository \
publishIosSimulatorArm64PublicationToSoloStudiosRepository \
publishTvosX64PublicationToSoloStudiosRepository \
publishTvosArm64PublicationToSoloStudiosRepository \
publishTvosSimulatorArm64PublicationToSoloStudiosRepository \
publishWatchosX64PublicationToSoloStudiosRepository \
publishWatchosArm64PublicationToSoloStudiosRepository \
publishWatchosSimulatorArm64PublicationToSoloStudiosRepository
- name: Publish MacOS/iOS/TvOS/WatchOS artifacts to Sonatype
if: startsWith(github.ref, 'refs/tags') # Only publish to sonatype if tagged
run: |
./gradlew \
publishMacosX64PublicationToSonatypeRepository \
publishMacosArm64PublicationToSonatypeRepository \
publishIosArm64PublicationToSonatypeRepository \
publishIosX64PublicationToSonatypeRepository \
publishIosSimulatorArm64PublicationToSonatypeRepository \
publishTvosX64PublicationToSonatypeRepository \
publishTvosArm64PublicationToSonatypeRepository
publishTvosSimulatorArm64PublicationToSonatypeRepository \
publishWatchosX64PublicationToSonatypeRepository \
publishWatchosArm64PublicationToSonatypeRepository \
publishWatchosSimulatorArm64PublicationToSonatypeRepository
publish-linux:
name: Publish Linux Artifacts
runs-on: ubuntu-latest
needs: [ create-staging-repo ]
env:
ORG_GRADLE_PROJECT_repositoryId: ${{ needs.create-staging-repo.outputs.repository-id }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-tags: true
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: "${{ env.JAVA_VERSION }}"
distribution: "${{ env.JAVA_DISTRIBUTION }}"
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Publish Linux/Multiplatform/JVM/JS artifacts to solo studios
run: |
./gradlew \
publishLinuxX64PublicationToSoloStudiosRepository \
publishLinuxArm64PublicationToSoloStudiosRepository \
publishKotlinMultiplatformPublicationToSoloStudiosRepository \
publishJvmPublicationToSoloStudiosRepository \
publishJsPublicationToSoloStudiosRepository
- name: Publish Linux/Multiplatform/JVM/JS artifacts to Sonatype
if: startsWith(github.ref, 'refs/tags') # Only publish to sonatype if tagged
run: |
./gradlew \
publishLinuxX64PublicationToSonatypeRepository \
publishLinuxArm64PublicationToSonatypeRepository \
publishKotlinMultiplatformPublicationToSonatypeRepository \
publishJvmPublicationToSonatypeRepository \
publishJsPublicationToSonatypeRepository
# finalize:
# runs-on: ubuntu-latest
# needs: [ create-staging-repo, publish-windows, publish-mac, publish-linux ]
# if: ${{ always() && needs.create-staging-repo.result == 'success' }}
# steps:
# - name: Discard
# if: ${{ needs.publish-windows.result != 'success' || needs.publish-mac.result != 'success' || needs.publish-linux.result != 'success' }}
# uses: nexus-actions/drop-nexus-staging-repo@59443053a1b36f5f71ede68776d73294bf4bfb5e
# with:
# username: ${{ secrets.SONATYPE_USERNAME }}
# password: ${{ secrets.SONATYPE_PASSWORD }}
# staging_repository_id: ${{ needs.create-staging-repo.outputs.repository-id }}
# - name: Release
# if: ${{ needs.publish-windows.result == 'success' && needs.publish-mac.result == 'success' && needs.publish-linux.result == 'success' }}
# uses: nexus-actions/release-nexus-staging-repo@f2b4c7f64ecec2cb0d24349182c1bbeda5c4c056
# with:
# username: ${{ secrets.SONATYPE_USERNAME }}
# password: ${{ secrets.SONATYPE_PASSWORD }}
# staging_repository_id: ${{ needs.create-staging-repo.outputs.repository-id }}