-
Notifications
You must be signed in to change notification settings - Fork 1.2k
285 lines (275 loc) · 12.3 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
name: publish
on:
push:
branches:
# For branches, better to list them explicitly than regexp include.
# Older branches are triggered using workflows present there
- main
- 3.6.x
permissions: read-all
env:
DOCS_ZIP: docs-zip
DOCS_ZIP_PATH: docs/build/distributions
jobs:
# General job notes: we DON'T want to cancel any previous runs, especially in the case of a "back to snapshots" build right after a release push
# We specify the ubuntu version to minimize the chances we have to deal with a migration during a release
prepare:
# Notes on prepare: this job has no access to secrets, only github token. As a result, all non-core actions are centralized here
# This includes the tagging and drafting of release notes. Still, when possible we favor plain run of gradle tasks
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
test-type:
- type: core
arguments: ":reactor-core:test --no-daemon"
- type: core-java21
arguments: ":reactor-core:java21Test --no-daemon"
- type: other
arguments: "check -x :reactor-core:test -x :reactor-core:java9Test -x :reactor-core:java21Test -x spotlessCheck -x :reactor-core:jcstress --no-daemon"
name: prepare - ${{ matrix.test-type.type }} tests
outputs:
versionType: ${{ steps.version.outputs.versionType }}
fullVersion: ${{ steps.version.outputs.fullVersion }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag=v4
- name: Download JDK 9
if: contains('main 3.6.x', github.base_ref)
run: ${GITHUB_WORKSPACE}/.github/setup.sh
shell: bash
- name: Setup JDK 9
if: contains('main 3.6.x', github.base_ref)
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # tag=v3
with:
distribution: 'jdkfile'
java-version: 9.0.4
jdkFile: /opt/openjdk/java9/OpenJDK9U-jdk_x64_linux_hotspot_9.0.4_11.tar.gz
- name: Setup JDK 21
if: contains('main 3.6.x', github.base_ref)
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # tag=v3
with:
distribution: 'temurin'
java-version: 21
- name: Setup JDK 8
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # tag=v3
with:
distribution: 'temurin'
java-version: 8
- name: interpret version
id: version
#we only run the qualifyVersionGha task so that no other console printing can hijack this step's output
#output: versionType, fullVersion
#fails if versionType is BAD, which interrupts the workflow
run: ./gradlew qualifyVersionGha
- name: run checks
id: checks
uses: gradle/actions/setup-gradle@d9c87d481d55275bb5441eef3fe0e46805f9ef70 # tag=v3
with:
arguments: ${{ matrix.test-type.arguments }}
# Build the docs-zip antora doc for the current branch, and upload generated docs-zip to workflow run.
# JDK21 is used because the antora plugin requires a JDK17 compatible version.
# Each deploy job can then download the docs-zip to ./docs/build/distributions/ in order to let it be included in published artifacts.
# (see gradle/setup.gradle publications which includes docs zip file, if found from docs/build/distributions directory)
build-docs-zip:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Set up Ruby for asciidoctor-pdf
uses: ruby/setup-ruby@cacc9f1c0b3f4eb8a16a6bb0ed10897b43b9de49 # v1
with:
ruby-version: 3.3.0
- name: Install asciidoctor-pdf / rouge
run: gem install asciidoctor-pdf rouge
- name: Setup java 21 for antora
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4
with:
distribution: 'temurin'
java-version: '21'
- name: Build antora docs zip distribution for the current branch
run: ./gradlew docs
- name: Upload docs/build to current workflow run
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
with:
name: ${{ env.DOCS_ZIP }}
path: ${{ env.DOCS_ZIP_PATH }}
retention-days: 3
if-no-files-found: error
#deploy the snapshot artifacts to Artifactory
deploySnapshot:
name: deploySnapshot
runs-on: ubuntu-20.04
needs: [prepare, build-docs-zip]
if: needs.prepare.outputs.versionType == 'SNAPSHOT'
environment: snapshots
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag=v4
- name: Download JDK 9
if: contains('main 3.6.x', github.base_ref)
run: ${GITHUB_WORKSPACE}/.github/setup.sh
shell: bash
- name: Setup JDK 9
if: contains('main 3.6.x', github.base_ref)
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # tag=v3
with:
distribution: 'jdkfile'
java-version: 9.0.4
jdkFile: /opt/openjdk/java9/OpenJDK9U-jdk_x64_linux_hotspot_9.0.4_11.tar.gz
- name: Setup JDK 21
if: contains('main 3.6.x', github.base_ref)
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # tag=v3
with:
distribution: 'temurin'
java-version: 21
- name: Setup JDK 8
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # tag=v3
with:
distribution: 'temurin'
java-version: 8
- name: Download antora docs-zip
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4
with:
name: ${{ env.DOCS_ZIP }}
path: ${{ env.DOCS_ZIP_PATH }}
- name: deploy
env:
ORG_GRADLE_PROJECT_artifactory_publish_username: ${{secrets.ARTIFACTORY_SNAPSHOT_USERNAME}}
ORG_GRADLE_PROJECT_artifactory_publish_password: ${{secrets.ARTIFACTORY_PASSWORD}}
run: |
./gradlew -Dorg.gradle.parallel=false assemble artifactoryPublish -Partifactory_publish_contextUrl=https://repo.spring.io -Partifactory_publish_repoKey=libs-snapshot-local
#sign the milestone artifacts and deploy them to Artifactory
deployMilestone:
name: deployMilestone
runs-on: ubuntu-20.04
needs: [prepare, build-docs-zip]
if: needs.prepare.outputs.versionType == 'MILESTONE'
environment: releases
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag=v4
- name: Download JDK 9
if: contains('main 3.6.x', github.base_ref)
run: ${GITHUB_WORKSPACE}/.github/setup.sh
shell: bash
- name: Setup JDK 9
if: contains('main 3.6.x', github.base_ref)
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # tag=v3
with:
distribution: 'jdkfile'
java-version: 9.0.4
jdkFile: /opt/openjdk/java9/OpenJDK9U-jdk_x64_linux_hotspot_9.0.4_11.tar.gz
- name: Setup JDK 21
if: contains('main 3.6.x', github.base_ref)
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # tag=v3
with:
distribution: 'temurin'
java-version: 21
- name: Setup JDK 8
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # tag=v3
with:
distribution: 'temurin'
java-version: 8
- name: Download antora docs-zip
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4
with:
name: ${{ env.DOCS_ZIP }}
path: ${{ env.DOCS_ZIP_PATH }}
- name: deploy
env:
ORG_GRADLE_PROJECT_artifactory_publish_username: ${{secrets.ARTIFACTORY_USERNAME}}
ORG_GRADLE_PROJECT_artifactory_publish_password: ${{secrets.ARTIFACTORY_PASSWORD}}
ORG_GRADLE_PROJECT_signingKey: ${{secrets.SIGNING_KEY}}
ORG_GRADLE_PROJECT_signingPassword: ${{secrets.SIGNING_PASSPHRASE}}
run: |
./gradlew -Dorg.gradle.parallel=false assemble sign artifactoryPublish -Partifactory_publish_contextUrl=https://repo.spring.io -Partifactory_publish_repoKey=libs-milestone-local
#sign the release artifacts and deploy them to Artifactory
deployRelease:
name: deployRelease
runs-on: ubuntu-20.04
needs: [prepare, build-docs-zip]
if: needs.prepare.outputs.versionType == 'RELEASE'
environment: releases
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag=v4
- name: Download JDK 9
if: contains('main 3.6.x', github.base_ref)
run: ${GITHUB_WORKSPACE}/.github/setup.sh
shell: bash
- name: Setup JDK 9
if: contains('main 3.6.x', github.base_ref)
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # tag=v3
with:
distribution: 'jdkfile'
java-version: 9.0.4
jdkFile: /opt/openjdk/java9/OpenJDK9U-jdk_x64_linux_hotspot_9.0.4_11.tar.gz
- name: Setup JDK 21
if: contains('main 3.6.x', github.base_ref)
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # tag=v3
with:
distribution: 'temurin'
java-version: 21
- name: Setup JDK 8
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # tag=v3
with:
distribution: 'temurin'
java-version: 8
- name: Download antora docs/build
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4
with:
name: ${{ env.DOCS_ZIP }}
path: ${{ env.DOCS_ZIP_PATH }}
- name: deploy
env:
ORG_GRADLE_PROJECT_artifactory_publish_username: ${{secrets.ARTIFACTORY_USERNAME}}
ORG_GRADLE_PROJECT_artifactory_publish_password: ${{secrets.ARTIFACTORY_PASSWORD}}
ORG_GRADLE_PROJECT_signingKey: ${{secrets.SIGNING_KEY}}
ORG_GRADLE_PROJECT_signingPassword: ${{secrets.SIGNING_PASSPHRASE}}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{secrets.SONATYPE_USERNAME}}
ORG_GRADLE_PROJECT_sonatypePassword: ${{secrets.SONATYPE_PASSWORD}}
run: |
./gradlew -Dorg.gradle.parallel=false assemble sign artifactoryPublish -Partifactory_publish_contextUrl=https://repo.spring.io -Partifactory_publish_repoKey=libs-release-local publishMavenJavaPublicationToSonatypeRepository
tagMilestone:
name: Tag milestone
needs: [ prepare, deployMilestone ]
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag=v4
- name: tag
run: |
git config --local user.name 'reactorbot'
git config --local user.email '[email protected]'
git tag -m "Release milestone ${{ needs.prepare.outputs.fullVersion }}" v${{ needs.prepare.outputs.fullVersion }} ${{ github.sha }}
git push --tags
tagRelease:
name: Tag release
needs: [ prepare, deployRelease ]
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag=v4
- name: tag
run: |
git config --local user.name 'reactorbot'
git config --local user.email '[email protected]'
git tag -m "Release version ${{ needs.prepare.outputs.fullVersion }}" v${{ needs.prepare.outputs.fullVersion }} ${{ github.sha }}
git push --tags
cleanup:
name: Cleanup docs-zip artifact
needs: [ deploySnapshot, tagRelease, tagMilestone ]
if: always() && (needs.deploySnapshot.result == 'success' || needs.tagRelease.result == 'success' || needs.tagMilestone.result == 'success')
runs-on: ubuntu-20.04
permissions:
actions: write
steps:
- name: delete antora docs-zip artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
ARTIFACTS_URL="/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts"
ARTIFACT_ID=$(gh api -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2022-11-28' $ARTIFACTS_URL | jq -r '.artifacts[] | select(.name == "'$DOCS_ZIP'") | .id // ""')
if [ -n "$ARTIFACT_ID" ]; then
gh api --method DELETE -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2022-11-28' /repos/${{github.repository}}/actions/artifacts/$ARTIFACT_ID}
fi
# For Gradle configuration of signing, see https://docs.gradle.org/current/userguide/signing_plugin.html#sec:in-memory-keys
# publishMavenJavaPublicationToSonatypeRepository only sends to a staging repository