Repository navigation
190 lines (167 loc) · 7.24 KB
/
Copy pathrelease.yml
File metadata and controls
190 lines (167 loc) · 7.24 KB
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
name: Release
# Tags only, and the tag is the version: the build reads it from GITHUB_REF_NAME and jreleaserDeploy
# refuses anything that is not a clean X.Y.Z or X.Y.Z.N.
#
# Two deployments per tag, because a published groupId:artifactId:version can never gain files
# afterwards: the jars go up as one, and every platform's native binary as another. Both are uploaded
# and validated only — the Portal holds them until someone presses publish.
#
# After both, a draft GitHub release on the tag collects the runnable jar, the IDE plugins and the native
# binaries.
#
# Needs four repository secrets: JRELEASER_MAVENCENTRAL_USERNAME and JRELEASER_MAVENCENTRAL_PASSWORD
# (the Central Portal user token) plus JRELEASER_GPG_SECRET_KEY and JRELEASER_GPG_PASSPHRASE. The draft
# release uses the workflow's own GITHUB_TOKEN.
on:
push:
tags:
- '*'
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
jars:
name: jars
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Install JDK 21
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: temurin
java-version: '21'
- name: Stage, sign and upload the jars
run: ./gradlew jreleaserDeploy
env:
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_SONATYPE_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }}
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_SONATYPE_PASSWORD: ${{ secrets.JRELEASER_MAVENCENTRAL_PASSWORD }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
- name: Keep JReleaser's log
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: jreleaser-log-jars
path: build/jreleaser/trace.log
if-no-files-found: ignore
retention-days: 7
# One job per platform, as in ci.yml, but here each one hands its binary to the deploy job below
# instead of throwing it away.
native-images:
name: native image (${{ matrix.platform }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include:
- platform: linux-x86-64
runner: ubuntu-latest
- platform: linux-aarch64
runner: ubuntu-24.04-arm
- platform: macos-aarch64
runner: macos-15
- platform: macos-x86-64
runner: macos-15-intel
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install GraalVM 25 for the image
uses: graalvm/setup-graalvm@5298d94fb55a4f185c602eeac5de1b553882abe2 # v1.6.4
with:
java-version: '25'
distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Compile the native image
run: ./gradlew -PnativeImage=true :open-java-format-native:nativeCompile
- name: Hand the binary to the deploy job
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: native-image-${{ matrix.platform }}
path: |
open-java-format-native/build/native/nativeCompile/open-java-format-*
!open-java-format-native/build/native/nativeCompile/*.txt
if-no-files-found: error
retention-days: 1
# Not `native`: ci.yml already has a job with that id, and `act --job native` could not tell them apart.
native-deploy:
name: native deploy
needs: native-images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Install JDK 21
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: temurin
java-version: '21'
# merge-multiple: every platform's binary lands in one directory under the name it was built
# with, which is where its Maven classifier is read from.
- name: Collect every platform's binary
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: native-images
pattern: native-image-*
merge-multiple: true
- name: Show what was collected
run: ls -l native-images
# No GraalVM here: nothing is compiled, the binaries are published exactly as they arrived.
- name: Stage, sign and upload the native images
run: ./gradlew -PreleaseTarget=native -PnativeImages=native-images jreleaserDeploy
env:
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_SONATYPE_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }}
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_SONATYPE_PASSWORD: ${{ secrets.JRELEASER_MAVENCENTRAL_PASSWORD }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
- name: Keep JReleaser's log
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: jreleaser-log-native
path: build/jreleaser/trace.log
if-no-files-found: ignore
retention-days: 7
# What Maven Central does not carry — the runnable formatter jar, the IntelliJ plugin zip, the Eclipse
# plugin jar, and every platform's native binary as a plain download — goes into a draft GitHub release
# on the tag, each file signed with the release key. Only once both deployments are in; publishing the
# draft is a click on GitHub, and a re-run fails while a release for the tag exists.
github-release:
name: draft GitHub release
needs: [jars, native-deploy]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Install JDK 21
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: temurin
java-version: '21'
- name: Collect every platform's binary
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: native-images
pattern: native-image-*
merge-multiple: true
- name: Build the IDE plugins and open the draft release
run: ./gradlew -PreleaseTarget=github -PnativeImages=native-images jreleaserRelease
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
- name: Keep JReleaser's log
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: jreleaser-log-github
path: build/jreleaser/trace.log
if-no-files-found: ignore
retention-days: 7