-
Notifications
You must be signed in to change notification settings - Fork 4
518 lines (474 loc) · 24.6 KB
/
extension-attach-artifact-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
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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
name: Attach Artifact to Release
on:
workflow_call:
inputs:
zip:
description: "Specify it if you want to attach a zip file to the release"
required: false
default: "false"
type: string
extraCommand:
description: "Specify it if you want to run an extra command before attaching the artifact"
required: false
default: ""
type: string
mavenProfiles:
description: "Specify it if you want to run different Maven profiles from the default (coverage). mavenProfiles example: 'coverage,run-proguard'"
required: false
default: ""
type: string
os:
description: "Operating system to build/test on"
required: false
default: '["ubuntu-latest", "windows-latest"]'
type: string
extraMavenArgs:
description: "Specify it if you want to run an extra maven argument"
required: false
default: ""
type: string
artifactPath:
description: "Specify the path to the artifacts that should be attached to the build. Useful for multi-module extensions."
required: false
default: "."
type: string
combineJars:
description: "Specify it if you want to combine jars into one"
required: false
default: false
type: boolean
dry_run:
description: "Specify it if you want to run a dry run"
required: false
default: false
type: boolean
dry_run_version:
description: "The version of the dry-run release"
required: false
type: string
secrets:
BOT_TOKEN:
description: "BOT_TOKEN from the caller workflow"
required: true
GPG_SECRET:
description: "GPG_SECRET from the caller workflow"
required: true
GPG_PASSPHRASE:
description: "GPG_PASSPHRASE from the caller workflow"
required: true
jobs:
build-multi-architecture:
strategy:
fail-fast: false
matrix:
os: ${{fromJson(inputs.os || '["ubuntu-latest"]')}}
name: Build & Package - ${{ matrix.os }}
if: ${{ inputs.combineJars }}
runs-on: ${{ matrix.os }}
concurrency:
group: attach-artifact-${{ github.ref }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "temurin"
cache: "maven"
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: ${{ env.MAVEN_VERSION }}
# look for dependencies in maven
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v22
with:
repositories: |
[
{
"id": "liquibase",
"url": "https://maven.pkg.github.com/liquibase/liquibase",
"releases": {
"enabled": "true"
},
"snapshots": {
"enabled": "true",
"updatePolicy": "always"
}
},
{
"id": "liquibase-pro",
"url": "https://maven.pkg.github.com/liquibase/liquibase-pro",
"releases": {
"enabled": "true"
},
"snapshots": {
"enabled": "true",
"updatePolicy": "always"
}
}
]
servers: |
[
{
"id": "liquibase-pro",
"username": "liquibot",
"password": "${{ secrets.LIQUIBOT_PAT }}"
},
{
"id": "liquibase",
"username": "liquibot",
"password": "${{ secrets.LIQUIBOT_PAT }}"
}
]
- name: Configure Git
run: |
git config user.name "liquibot"
git config user.email "[email protected]"
- name: Run extra command
if: inputs.extraCommand != ''
run: |
${{ inputs.extraCommand }}
- name: Run extra Linux command
if: inputs.extraLinuxCommand != ''
run: |
${{ inputs.extraLinuxCommand }}
- name: Build and Package
if: ${{ inputs.dry_run == false }}
working-directory: ${{ inputs.artifactPath }}
shell: bash
run: |
mvn -B release:clean release:prepare -Darguments="-Dusername=liquibot -Dpassword=$GITHUB_TOKEN -Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true -Dmaven.deploy.skip=true" -DcheckModificationExcludeList=** -DignoreSnapshots=true -DreleaseVersion=${{ github.event.inputs.liquibaseVersion }} -DpushChanges=false -P '${{ inputs.mavenProfiles }}'
git reset HEAD~ --hard
mvn -B dependency:go-offline clean package -DskipTests=true ${{ inputs.extraMavenArgs }} -P '${{ inputs.mavenProfiles }}'
- name: Build and Package (dry-run)
if: ${{ inputs.dry_run == true }}
working-directory: ${{ inputs.artifactPath }}
shell: bash
run: |
mvn -B release:clean release:prepare -Darguments="-Dusername=liquibot -Dpassword=$GITHUB_TOKEN -Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true -Dmaven.deploy.skip=true" -DcheckModificationExcludeList=** -DignoreSnapshots=true -DreleaseVersion=${{ inputs.dry_run_version }} -DpushChanges=false -P '${{ inputs.mavenProfiles }}'
git reset HEAD~ --hard
mvn -B dependency:go-offline clean package -DskipTests=true ${{ inputs.extraMavenArgs }} -P '${{ inputs.mavenProfiles }}'
- name: Get Artifact ID
working-directory: ${{ inputs.artifactPath }}
id: get-artifact-id
shell: bash
run: |
artifact_id=$(mvn help:evaluate "-Dexpression=project.artifactId" -q -DforceStdout)
echo "artifact_id=$artifact_id" >> $GITHUB_OUTPUT
- name: Get Artifact Version
if: ${{ inputs.dry_run == false }}
working-directory: ${{ inputs.artifactPath }}
id: get-artifact-version
shell: bash
run: |
artifact_version=$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout)
echo "artifact_version=$artifact_version" >> $GITHUB_OUTPUT
- name: Get Artifact Version
if: ${{ inputs.dry_run == true }}
working-directory: ${{ inputs.artifactPath }}
id: get-artifact-version-dry-run
shell: bash
run: |
echo "artifact_version=${{ inputs.dry_run_version }}" >> $GITHUB_OUTPUT
- name: Save Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.get-artifact-id.outputs.artifact_id }}-${{ matrix.os }}-${{ steps.get-artifact-version.outputs.artifact_version }}-artifacts
path: |
${{ inputs.artifactPath }}/target/*
outputs:
artifact_id: ${{ steps.get-artifact-id.outputs.artifact_id }}
artifact_version: ${{ steps.get-artifact-version.outputs.artifact_version }}
combineJars:
needs: [build-multi-architecture]
if: ${{ inputs.combineJars }}
name: Combine Jars
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Ubuntu Artifacts
uses: actions/download-artifact@v4
with:
name: ${{needs.build-multi-architecture.outputs.artifact_id}}-ubuntu-latest-${{needs.build-multi-architecture.outputs.artifact_version}}-artifacts
path: /tmp/ubuntu
- name: Download macOS Artifacts
uses: actions/download-artifact@v4
with:
name: ${{needs.build-multi-architecture.outputs.artifact_id}}-macos-latest-${{needs.build-multi-architecture.outputs.artifact_version}}-artifacts
path: /tmp/macos
- name: Download Windows Artifacts
uses: actions/download-artifact@v4
with:
name: ${{needs.build-multi-architecture.outputs.artifact_id}}-windows-latest-${{needs.build-multi-architecture.outputs.artifact_version}}-artifacts
path: /tmp/windows
- name: Create multiplatform jar
run: |
rm -rf /tmp/combined/ubuntu /tmp/combined/windows /tmp/combined/macos
mkdir -p /tmp/combined/ubuntu /tmp/combined/windows /tmp/combined/macos
unzip -d /tmp/combined/ubuntu /tmp/ubuntu/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}.jar
unzip -d /tmp/combined/windows /tmp/windows/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}.jar
unzip -d /tmp/combined/macos /tmp/macos/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}.jar
rm -r -f /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}
mkdir /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}
cp -a /tmp/combined/ubuntu/* /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}/
cp -a /tmp/combined/windows/* /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}/
cp -a /tmp/combined/macos/* /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}/
rm /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}/org.graalvm.python.vfs/fileslist.txt
cat /tmp/combined/ubuntu/org.graalvm.python.vfs/fileslist.txt /tmp/combined/windows/org.graalvm.python.vfs/fileslist.txt /tmp/combined/macos/org.graalvm.python.vfs/fileslist.txt > /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}/org.graalvm.python.vfs/fileslist.txt
rm -f /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}.jar
cd /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}/
zip -r ../${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}.jar *
cd ..
cp /tmp/ubuntu/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}-sources.jar /tmp/combined/
cp /tmp/ubuntu/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}-javadoc.jar /tmp/combined/
cp /tmp/ubuntu/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}.pom /tmp/combined/
- name: Upload multiplatform artifact
uses: actions/upload-artifact@v4
with:
name: multiplatform-artifacts
path: |
/tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}.jar
/tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}-sources.jar
/tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}-javadoc.jar
/tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}.pom
attach-to-release:
if: always()
name: Attach Artifact to Release
needs: [combineJars]
runs-on: ubuntu-latest
concurrency:
group: attach-artifact-${{ github.ref }}
steps:
- run: sleep 30
if: ${{ inputs.dry_run == false }}
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "temurin"
cache: "maven"
# look for dependencies in maven
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v22
with:
repositories: |
[
{
"id": "liquibase",
"url": "https://maven.pkg.github.com/liquibase/liquibase",
"releases": {
"enabled": "true"
},
"snapshots": {
"enabled": "true",
"updatePolicy": "always"
}
},
{
"id": "liquibase-pro",
"url": "https://maven.pkg.github.com/liquibase/liquibase-pro",
"releases": {
"enabled": "true"
},
"snapshots": {
"enabled": "true",
"updatePolicy": "always"
}
}
]
servers: |
[
{
"id": "liquibase-pro",
"username": "liquibot",
"password": "${{ secrets.LIQUIBOT_PAT }}"
},
{
"id": "liquibase",
"username": "liquibot",
"password": "${{ secrets.LIQUIBOT_PAT }}"
}
]
- name: Get Reusable Script Files
run: |
curl -o $PWD/.github/get_draft_release.sh https://raw.githubusercontent.com/liquibase/build-logic/main/.github/get_draft_release.sh
curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/main/.github/sign_artifact.sh
curl -o $PWD/.github/upload_asset.sh https://raw.githubusercontent.com/liquibase/build-logic/main/.github/upload_asset.sh
chmod +x $PWD/.github/get_draft_release.sh
chmod +x $PWD/.github/sign_artifact.sh
chmod +x $PWD/.github/upload_asset.sh
- name: Configure Git
run: |
git config user.name "liquibot"
git config user.email "[email protected]"
- name: Get Artifact ID
working-directory: ${{ inputs.artifactPath }}
id: get-artifact-id
run: echo "artifact_id=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV
- name: Run extra command
if: inputs.extraCommand
run: |
${{ inputs.extraCommand }}
- name: Check and download artifacts from GPM
if: ${{ inputs.dry_run == false }}
id: check-download-artifacts
env:
ARTIFACT_NAME: ${{ github.event.repository.name }}
run: |
RELEASE_VERSION=$(grep -m2 '<version>' pom.xml | tail -n 1 | awk -F'[><]' '{print $3}' | sed 's/-SNAPSHOT//')
echo "RELEASE_VERSION=$RELEASE_VERSION"
mvn dependency:get -DgroupId=org.liquibase.ext -DartifactId=${{ env.ARTIFACT_NAME }} -Dversion=$RELEASE_VERSION -Dtransitive=false || echo "Failed to download artifact"
mvn dependency:get -DgroupId=org.liquibase.ext -DartifactId=${{ env.ARTIFACT_NAME }} -Dversion=$RELEASE_VERSION -Dpackaging=pom -Dtransitive=false || echo "Failed to download pom artifact"
mvn dependency:get -DgroupId=org.liquibase.ext -DartifactId=${{ env.ARTIFACT_NAME }} -Dversion=$RELEASE_VERSION -Dclassifier=sources -Dtransitive=false || echo "Failed to download sources artifact"
mvn dependency:get -DgroupId=org.liquibase.ext -DartifactId=${{ env.ARTIFACT_NAME }} -Dversion=$RELEASE_VERSION -Dclassifier=javadoc -Dtransitive=false || echo "Failed to download javadoc artifact"
rm -rf ~/.m2/repository/org/liquibase/ext/${{ env.ARTIFACT_NAME }}/$RELEASE_VERSION/*.lastUpdated
ARTIFACT_FOUND=$(ls -1 ~/.m2/repository/org/liquibase/ext/${{ env.ARTIFACT_NAME }}/$RELEASE_VERSION/ 2>/dev/null | wc -l)
echo "ARTIFACT_FOUND=$ARTIFACT_FOUND" >> $GITHUB_ENV
if [ $ARTIFACT_FOUND -eq 0 ]; then
echo "No artifact found"
else
echo "Artifact found"
rm -rf ./target && mkdir -p ./target
mv ~/.m2/repository/org/liquibase/ext/${{ env.ARTIFACT_NAME }}/$RELEASE_VERSION/* ./target
sed -i 's/-SNAPSHOT//g' pom.xml
fi
- name: Build release artifacts
working-directory: ${{ inputs.artifactPath }}
if: ${{ env.ARTIFACT_FOUND == '0' && inputs.dry_run == false }}
id: build-release-artifacts
run: |
mvn -B release:clean release:prepare -Darguments="-Dusername=liquibot -Dpassword=$GITHUB_TOKEN -Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true -Dmaven.deploy.skip=true" -DcheckModificationExcludeList=** -DignoreSnapshots=true -DreleaseVersion=${{ github.event.inputs.liquibaseVersion }} -DpushChanges=false -P '${{ inputs.mavenProfiles }}'
git reset HEAD~ --hard
# Determine the default branch (master or main)
if git rev-parse --verify origin/master >/dev/null 2>&1; then
DEFAULT_BRANCH="master"
elif git rev-parse --verify origin/main >/dev/null 2>&1; then
DEFAULT_BRANCH="main"
else
echo "Neither master nor main branch found. Exiting."
exit 1
fi
LAST_COMMIT_HASH=$(git rev-parse origin/$DEFAULT_BRANCH)
mvn clean install -DskipTests -P '${{ inputs.mavenProfiles }}' -DbuildNumber=$LAST_COMMIT_HASH
- name: Build release artifacts (dry-run)
working-directory: ${{ inputs.artifactPath }}
if: ${{ inputs.dry_run == true }}
id: build-release-artifacts-dry-run
run: |
mvn -B release:clean release:prepare -Darguments="-Dusername=liquibot -Dpassword=$GITHUB_TOKEN -Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true -Dmaven.deploy.skip=true" -DcheckModificationExcludeList=** -DignoreSnapshots=true -DreleaseVersion=${{ inputs.dry_run_version }} -DpushChanges=false -P '${{ inputs.mavenProfiles }}'
git reset HEAD~ --hard
# Determine the default branch (master or main)
if git rev-parse --verify origin/master >/dev/null 2>&1; then
DEFAULT_BRANCH="master"
elif git rev-parse --verify origin/main >/dev/null 2>&1; then
DEFAULT_BRANCH="main"
else
echo "Neither master nor main branch found. Exiting."
exit 1
fi
LAST_COMMIT_HASH=$(git rev-parse origin/$DEFAULT_BRANCH)
mvn clean install -DskipTests -P '${{ inputs.mavenProfiles }}' -DbuildNumber=$LAST_COMMIT_HASH
- name: Download multiarchitecture release artifacts
if: inputs.combineJars
uses: actions/download-artifact@v4
with:
name: multiplatform-artifacts
path: ${{ inputs.artifactPath }}/target
- name: Get latest draft release ID
if: ${{ inputs.dry_run == false }}
id: get-release
run: |
LATEST_DRAFT_RELEASE=$(curl -X GET -H "Authorization: token ${{ secrets.BOT_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases?per_page=1" | jq -r 'if .[].draft == true then .[].id else empty end')
echo "Latest Draft Release ID: $LATEST_DRAFT_RELEASE"
echo "RELEASE_ID=$LATEST_DRAFT_RELEASE" >> $GITHUB_ENV
- name: List artifacts in release
if: ${{ env.RELEASE_ID != '' && env.RELEASE_ID != null && inputs.dry_run == false }}
id: list-artifacts
run: |
RELEASE_ID="${{ env.RELEASE_ID }}"
ARTIFACTS=$(curl -X GET -H "Authorization: token ${{ secrets.BOT_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID/assets" | jq -r '.[].id')
echo "Artifacts to delete: $ARTIFACTS"
ARTIFACTS_CLEANED=$(echo "$ARTIFACTS" | tr -s '[:space:]' ',' | sed 's/,$//')
echo "ARTIFACTS_TO_DELETE=$ARTIFACTS_CLEANED" >> $GITHUB_ENV
- name: Delete artifacts
if: ${{ env.ARTIFACTS_TO_DELETE != null && inputs.dry_run == false }}
run: |
RELEASE_ID="${{ env.RELEASE_ID }}"
ARTIFACTS_TO_DELETE="${{ env.ARTIFACTS_TO_DELETE }}"
IFS=',' read -ra values <<< "$ARTIFACTS_TO_DELETE"
for value in "${values[@]}"; do
curl -X DELETE -H "Authorization: token ${{ secrets.BOT_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases/assets/$value"
echo "Deleted artifact ID: $value"
done
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_SECRET }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Set root directory variable
run: echo "REPO_ROOT=$(git rev-parse --show-toplevel)" >> $GITHUB_ENV
- name: Sign Files for Draft Release
if: ${{ inputs.dry_run == false }}
working-directory: ${{ inputs.artifactPath }}
run: |
gpg -K
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
${{ env.REPO_ROOT }}/.github/sign_artifact.sh ${{ env.REPO_ROOT }}/${{ inputs.artifactPath }}/target/${{ env.artifact_id }}-${version}.jar
${{ env.REPO_ROOT }}/.github/sign_artifact.sh ${{ env.REPO_ROOT }}/${{ inputs.artifactPath }}/target/${{ env.artifact_id }}-${version}.pom
${{ env.REPO_ROOT }}/.github/sign_artifact.sh ${{ env.REPO_ROOT }}/${{ inputs.artifactPath }}/target/${{ env.artifact_id }}-${version}-javadoc.jar
${{ env.REPO_ROOT }}/.github/sign_artifact.sh ${{ env.REPO_ROOT }}/${{ inputs.artifactPath }}/target/${{ env.artifact_id }}-${version}-sources.jar
- name: Sign Files for Draft Release (dry-run)
if: ${{ inputs.dry_run == true }}
working-directory: ${{ inputs.artifactPath }}
run: |
gpg -K
version=${{ inputs.dry_run_version }}
${{ env.REPO_ROOT }}/.github/sign_artifact.sh ${{ env.REPO_ROOT }}/${{ inputs.artifactPath }}/target/${{ env.artifact_id }}-${version}.jar
${{ env.REPO_ROOT }}/.github/sign_artifact.sh ${{ env.REPO_ROOT }}/${{ inputs.artifactPath }}/target/${{ env.artifact_id }}-${version}.pom
${{ env.REPO_ROOT }}/.github/sign_artifact.sh ${{ env.REPO_ROOT }}/${{ inputs.artifactPath }}/target/${{ env.artifact_id }}-${version}-javadoc.jar
${{ env.REPO_ROOT }}/.github/sign_artifact.sh ${{ env.REPO_ROOT }}/${{ inputs.artifactPath }}/target/${{ env.artifact_id }}-${version}-sources.jar
- name: Set draft release title
if: ${{ inputs.dry_run == false }}
working-directory: ${{ inputs.artifactPath }}
id: set-release-title
run: |
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
RELEASE_TITLE="v$version"
echo "Updating release title to $RELEASE_TITLE"
curl -X PATCH -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" -d '{"name": "'"$RELEASE_TITLE"'", "tag_name": "'"v$version"'"}' "https://api.github.com/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }}"
- name: Attach Files to Draft Release
if: ${{ inputs.dry_run == false }}
working-directory: ${{ inputs.artifactPath }}
id: upload-release-asset
run: ${{ env.REPO_ROOT }}/.github/upload_asset.sh $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
ASSET_NAME_PREFIX: "${{ env.artifact_id }}-"
ASSET_DIR: ./target
- name: Attach Files to Draft Release (dry-run)
id: attach-files-dry-run
if: ${{ inputs.dry_run == true }}
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ inputs.dry_run_version }}
fail_on_unmatched_files: true
body: Dry Run ${{ inputs.dry_run_version }}
generate_release_notes: true
draft: true
files: ./target/*
- name: Get upload_zip.sh Script File
if: inputs.zip == 'true'
run: |
curl -o $PWD/.github/upload_zip.sh https://raw.githubusercontent.com/liquibase/build-logic/main/.github/upload_zip.sh
chmod +x $PWD/.github/upload_zip.sh
- name: Attach Zip File to Draft Release
if: inputs.zip == 'true'
id: upload-release-zip
run: ./.github/upload_zip.sh $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
ASSET_NAME_PREFIX: "${{ env.artifact_id }}-"
ASSET_DIR: ./target