-
Notifications
You must be signed in to change notification settings - Fork 1
267 lines (252 loc) · 10 KB
/
release.yml
File metadata and controls
267 lines (252 loc) · 10 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
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
name: Gradle Release (Axion)
on:
workflow_call:
inputs:
java-version:
description: 'Java version to use'
default: '17'
required: false
type: string
version:
description: 'Release version (e.g., 0.5.1). Leave empty to auto-increment.'
required: false
type: string
version-increment:
description: 'Version increment type (used if version is not specified)'
default: 'patch'
required: false
type: string
gradle-build-tasks:
description: 'Gradle tasks to run after creating release tag (e.g., "build publish")'
default: 'build'
required: false
type: string
jreleaser-version:
description: 'JReleaser version to use'
default: 'latest'
required: false
type: string
jreleaser-arguments:
description: 'Additional JReleaser arguments to run before full-release (e.g., "assemble --assembler jlink")'
default: ''
required: false
type: string
clone-to-dist-repo:
description: 'Whether to clone release to a -dist repository'
default: true
required: false
type: boolean
update-antora-version:
description: 'Whether to update docs/antora.yml version after release'
default: true
required: false
type: boolean
antora-version:
description: 'Optional explicit version to set in docs/antora.yml. Defaults to the release version.'
default: ''
required: false
type: string
antora-display-version:
description: 'Optional display_version to set in docs/antora.yml.'
default: ''
required: false
type: string
antora-prerelease:
description: 'Optional prerelease value to set in docs/antora.yml.'
default: ''
required: false
type: string
runs-on:
description: 'Runner to use for the release job'
default: 'ubuntu-latest'
required: false
type: string
pre-release-script:
description: 'Shell script to run after build and before JReleaser (e.g., for ECR login, S3 uploads, etc.)'
default: ''
required: false
type: string
skip-announce:
description: 'Skip announcements (Slack, etc.) for this release'
default: false
required: false
type: boolean
skip-tests:
description: 'Skip tests during build (adds -x test flag to Gradle)'
default: false
required: false
type: boolean
working-directory:
description: 'Working directory for Gradle and JReleaser commands'
default: '.'
required: false
type: string
tag-prefix:
description: 'Tag prefix (e.g., "v", "java-client-v")'
default: 'v'
required: false
type: string
git-root-search:
description: 'Search for Git root directory (for monorepo support)'
default: false
required: false
type: boolean
aws-role-arn:
description: 'AWS IAM role ARN for OIDC authentication (for pre-release-script)'
required: false
type: string
aws-region:
description: 'AWS region (used with aws-role-arn or aws secrets)'
default: 'us-east-1'
required: false
type: string
secrets:
git-access-token:
description: 'GitHub token with write access'
required: true
gpg-passphrase:
description: 'GPG passphrase for signing'
required: true
gpg-public-key:
description: 'GPG public key'
required: true
gpg-secret-key:
description: 'GPG secret key'
required: true
sonatype-username:
description: 'Sonatype username for Maven Central'
required: false
sonatype-password:
description: 'Sonatype password for Maven Central'
required: false
slack-webhook:
description: 'Slack webhook URL for notifications'
required: false
docker-username:
description: 'Docker registry username (for bootBuildImage)'
required: false
docker-password:
description: 'Docker registry password (for bootBuildImage)'
required: false
aws-access-key-id:
description: 'AWS access key ID (for pre-release-script, alternative to OIDC)'
required: false
aws-secret-access-key:
description: 'AWS secret access key (for pre-release-script, alternative to OIDC)'
required: false
unlock-public-key:
description: 'Base64-encoded Ed25519 public key for unlock token verification'
required: false
jobs:
release:
runs-on: ${{ inputs.runs-on }}
permissions:
contents: write
packages: write
id-token: write # Required for AWS OIDC
steps:
- name: Checkout
uses: redis/github-workflows/.github/actions/checkout@main
with:
fetch-depth: 0
token: ${{ secrets.git-access-token }}
- name: Setup Gradle
uses: redis/github-workflows/.github/actions/setup-gradle@main
with:
java-version: ${{ inputs.java-version }}
- name: Create Release Tag
id: release
uses: redis/github-workflows/.github/actions/create-release-tag@main
with:
version: ${{ inputs.version }}
version-increment: ${{ inputs.version-increment }}
git-access-token: ${{ secrets.git-access-token }}
working-directory: ${{ inputs.working-directory }}
tag-prefix: ${{ inputs.tag-prefix }}
- name: Build
working-directory: ${{ inputs.working-directory }}
env:
DOCKER_USERNAME: ${{ secrets.docker-username }}
DOCKER_PASSWORD: ${{ secrets.docker-password }}
UNLOCK_PUBLIC_KEY: ${{ secrets.unlock-public-key }}
run: ./gradlew ${{ inputs.gradle-build-tasks }} ${{ inputs.skip-tests && '-x test -x integrationTest' || '' }}
- name: Configure AWS credentials
if: inputs.pre-release-script != ''
uses: redis/github-workflows/.github/actions/configure-aws@main
with:
aws-role-arn: ${{ inputs.aws-role-arn }}
aws-access-key-id: ${{ secrets.aws-access-key-id }}
aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
aws-region: ${{ inputs.aws-region }}
continue-on-error: true
- name: Pre-Release Script
if: inputs.pre-release-script != ''
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.pre-release-script }}
- name: Set up Docker Buildx
uses: redis/github-workflows/.github/actions/setup-buildx@main
- name: JReleaser Pre-Release
if: inputs.jreleaser-arguments != ''
uses: redis/github-workflows/.github/actions/jreleaser@main
with:
version: ${{ steps.release.outputs.version }}
git-access-token: ${{ secrets.git-access-token }}
jreleaser-version: ${{ inputs.jreleaser-version }}
arguments: ${{ inputs.jreleaser-arguments }}
skip-announce: ${{ inputs.skip-announce }}
artifact-name-suffix: '-pre-release'
working-directory: ${{ inputs.working-directory }}
git-root-search: ${{ inputs.git-root-search }}
- name: Release with JReleaser
uses: redis/github-workflows/.github/actions/jreleaser@main
with:
version: ${{ steps.release.outputs.version }}
git-access-token: ${{ secrets.git-access-token }}
gpg-secret-key: ${{ secrets.gpg-secret-key }}
gpg-public-key: ${{ secrets.gpg-public-key }}
gpg-passphrase: ${{ secrets.gpg-passphrase }}
sonatype-username: ${{ secrets.sonatype-username }}
sonatype-password: ${{ secrets.sonatype-password }}
slack-webhook: ${{ secrets.slack-webhook }}
docker-username: ${{ secrets.docker-username }}
docker-password: ${{ secrets.docker-password }}
jreleaser-version: ${{ inputs.jreleaser-version }}
skip-announce: ${{ inputs.skip-announce }}
working-directory: ${{ inputs.working-directory }}
git-root-search: ${{ inputs.git-root-search }}
- name: Cleanup disk space
run: |
echo "Disk usage before cleanup:"
df -h
# Remove Docker images to free up space (they've already been pushed)
docker system prune -af --volumes || true
# Remove Gradle caches that are no longer needed
rm -rf ~/.gradle/caches/build-cache-* || true
# Remove build directories
rm -rf ${{ inputs.working-directory }}/build/libs/*.jar || true
rm -rf ${{ inputs.working-directory }}/build/distributions/*.tar || true
rm -rf ${{ inputs.working-directory }}/build/distributions/*.zip || true
echo "Disk usage after cleanup:"
df -h
- name: Clone to Dist Repo
if: inputs.clone-to-dist-repo
uses: redis/github-workflows/.github/actions/clone-to-dist-repo@main
with:
git-access-token: ${{ secrets.git-access-token }}
source-repo: ${{ github.repository }}
dest-repo: ${{ github.repository }}-dist
- name: Update Antora Version
if: inputs.update-antora-version
uses: redis/github-workflows/.github/actions/update-antora-version@main
with:
version: ${{ inputs.antora-version != '' && inputs.antora-version || steps.release.outputs.version }}
display-version: ${{ inputs.antora-display-version }}
prerelease: ${{ inputs.antora-prerelease }}
git-access-token: ${{ secrets.git-access-token }}
- name: Cleanup Tag on Failure
if: failure() && steps.release.outputs.version != ''
run: |
echo "Release failed, cleaning up tag ${{ inputs.tag-prefix }}${{ steps.release.outputs.version }}"
git push --delete origin "${{ inputs.tag-prefix }}${{ steps.release.outputs.version }}" || true
git tag -d "${{ inputs.tag-prefix }}${{ steps.release.outputs.version }}" || true
echo "Tag cleanup completed"