214 lines (186 loc) · 8.92 KB
/
create-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
name: Attach Artifacts To Draft Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version (example: 4.8.2)'
required: true
branch:
description: 'Branch to release (Defaults to master)'
required: false
runId:
description: 'RunId of liquibase/liquibase artifacts to attach'
required: true
jobs:
setup:
name: Setup
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.collect-data.outputs.version }}
branch: ${{ steps.collect-data.outputs.branch }}
runId: ${{ steps.collect-data.outputs.runId }}
uber_jar_runId: ${{ steps.get_run_id.outputs.run_id }}
steps:
- name: Collect Data
id: collect-data
uses: actions/github-script@v7
with:
script: |
core.setOutput("version", context.payload.inputs.version);
core.setOutput("branch", context.payload.inputs.branch || "master");
core.setOutput("runId", context.payload.inputs.runId);
- run: |
echo "Creating version ${{ steps.collect-data.outputs.version }} from ${{ steps.collect-data.outputs.branch }} with artifacts from build ${{ steps.collect-data.outputs.runId }} "
build-azure-uber-jar:
needs: [ setup ]
uses: liquibase/liquibase/.github/workflows/build-azure-uber-jar.yml@master
with:
branch: ${{ needs.setup.outputs.branch }}
liquibase-version: ${{ needs.setup.outputs.version }}
secrets: inherit
reversion:
needs: [ setup, build-azure-uber-jar ]
name: Re-version artifacts ${{ needs.setup.outputs.version }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
name: Checkout liquibase-pro
with:
repository: liquibase/liquibase-pro
ref: "${{ needs.setup.outputs.branch }}"
path: download/repo/liquibase-pro
token: ${{ secrets.BOT_TOKEN }}
- name: Download liquibase-artifacts
uses: liquibase/action-download-artifact@v2-liquibase
with:
workflow: run-tests.yml
run_id: ${{ needs.setup.outputs.runId }}
name: liquibase-artifacts
path: download/liquibase-artifacts
- name: Get Current Run ID
id: get_run_id
run: |
run_id=${{ github.run_id }}
echo "uber_jar_runId=${run_id}" >> $GITHUB_OUTPUT
- name: Download liquibase-pro-azure-artifacts
uses: liquibase/action-download-artifact@v2-liquibase
with:
workflow: build-azure-uber-jar.yml
run_id: ${{ steps.get_run_id.outputs.run_id }}
name: liquibase-pro-azure-artifacts
path: liquibase-pro/liquibase-azure-deps
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'adopt'
gpg-private-key: ${{ secrets.GPG_SECRET }}
gpg-passphrase: GPG_PASSPHRASE
env:
GPG_PASSWORD: ${{ secrets.GPG_PASSPHRASE }}
- name: Re-version Artifacts
env:
GPG_PASSWORD: ${{ secrets.GPG_PASSPHRASE }}
run: |
scripts_branch=${{ github.ref }}
mkdir -p $PWD/.github/util/
# Download a script (re-version.sh) from a URL and save it to the specified directory
curl -o $PWD/.github/util/re-version.sh https://raw.githubusercontent.com/liquibase/liquibase/$scripts_branch/.github/util/re-version.sh
# Download another script (sign-artifacts.sh) from a URL and save it to the specified directory
curl -o $PWD/.github/util/sign-artifacts.sh https://raw.githubusercontent.com/liquibase/liquibase/$scripts_branch/.github/util/sign-artifacts.sh
curl -o $PWD/.github/util/ManifestReversion.java https://raw.githubusercontent.com/liquibase/liquibase/$scripts_branch/.github/util/ManifestReversion.java
chmod +x $PWD/.github/util/re-version.sh
chmod +x $PWD/.github/util/ManifestReversion.java
chmod +x $PWD/.github/util/sign-artifacts.sh
$PWD/.github/util/re-version.sh download/liquibase-artifacts "${{ needs.setup.outputs.version }}" "${{ needs.setup.outputs.branch }}"
# Execute the sign-artifacts.sh script with specific arguments
$PWD/.github/util/sign-artifacts.sh download/liquibase-artifacts "${{ needs.setup.outputs.version }}" "${{ needs.setup.outputs.branch }}"
##Sign Files
## liquibase-azure-deps is already on its correct version. Check reusable workflow: build-azure-uber-jar.yml
mv liquibase-pro/liquibase-azure-deps/* re-version/out
$PWD/.github/util/sign-artifacts.sh re-version/out
# Move files to a specific directory
mkdir re-version/final
mv re-version/out/liquibase-core-${{ needs.setup.outputs.version }}.jar re-version/final
mv re-version/out/liquibase-commercial-${{ needs.setup.outputs.version }}.jar re-version/final
mv re-version/out/liquibase-${{ needs.setup.outputs.version }}.tar.gz re-version/final
mv re-version/out/liquibase-${{ needs.setup.outputs.version }}.zip re-version/final
mv re-version/out/liquibase-azure-deps-${{ needs.setup.outputs.version }}.jar re-version/final/liquibase-azure-deps-${{ needs.setup.outputs.version }}.jar
(cd re-version/out/ && zip liquibase-additional-${{ needs.setup.outputs.version }}.zip *)
- name: Cache Completed Artifacts
uses: actions/cache@v4.0.2
with:
key: completed-artifacts-${{ github.run_number }}-${{ github.run_attempt }}
path: re-version/final
- name: Set repository tags
run: |
git tag -f v${{ needs.setup.outputs.version }}
git push -f origin v${{ needs.setup.outputs.version }}
(cd download/repo/liquibase-pro && git tag -f v${{ needs.setup.outputs.version }})
(cd download/repo/liquibase-pro && git push -f origin v${{ needs.setup.outputs.version }})
build-installers:
permissions:
contents: write # for softprops/action-gh-release to create GitHub release
needs: [ setup, reversion ]
name: Build Installers
runs-on: macos-13 #needs macos for apple notarization
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Restore Completed Artifacts
uses: actions/cache@v4.0.2
with:
key: completed-artifacts-${{ github.run_number }}-${{ github.run_attempt }}
path: re-version/final
- name: Set up JDK for GPG
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'adopt'
gpg-private-key: ${{ secrets.GPG_SECRET }}
gpg-passphrase: GPG_PASSPHRASE
env:
GPG_PASSWORD: ${{ secrets.GPG_PASSPHRASE }}
- name: Re-version Installers
env:
INSTALL4J_10_LICENSE: ${{ secrets.INSTALL4J_10_LICENSE }}
INSTALL4J_APPLE_KEY: ${{ secrets.INSTALL4J_APPLE_KEY }}
INSTALL4J_APPLE_KEY_PASSWORD: ${{ secrets.INSTALL4J_APPLE_KEY_PASSWORD }}
INSTALL4J_APPLE_ID: ${{ secrets.INSTALL4J_APPLE_ID }}
INSTALL4J_APPLE_ID_PASSWORD: ${{ secrets.INSTALL4J_APPLE_ID_PASSWORD }}
INSTALL4J_WINDOWS_KEY: ${{ secrets.INSTALL4J_WINDOWS_KEY }}
INSTALL4J_WINDOWS_KEY_PASSWORD: ${{ secrets.INSTALL4J_WINDOWS_KEY_PASSWORD }}
GPG_PASSWORD: ${{ secrets.GPG_PASSPHRASE }}
run: |
mkdir -p liquibase-dist/target/keys
echo "Saving apple key"
echo "$INSTALL4J_APPLE_KEY" | base64 -d > liquibase-dist/target/keys/datical_apple.p12
echo "Saving windows key"
echo "$INSTALL4J_WINDOWS_KEY" | base64 -d > liquibase-dist/target/keys/datical_windows.pfx
version="${{ needs.setup.outputs.version }}"
##### Rebuild installers
tarFile=$(pwd)/re-version/final/liquibase-$version.tar.gz
scriptDir=$(pwd)/.github/util/
mkdir -p liquibase-dist/target/liquibase-$version
(cd liquibase-dist/target/liquibase-$version && tar xfz $tarFile)
(cd liquibase-dist && $scriptDir/package-install4j.sh $version)
mv liquibase-dist/target/liquibase-*-installer-* re-version/final
##Sign Files
$PWD/.github/util/sign-artifacts.sh re-version/final
(cd re-version/final && zip liquibase-additional-$version.zip *.asc *.md5 *.sha1)
rm re-version/final/*.asc
rm re-version/final/*.md5
rm re-version/final/*.sha1
- name: Attach Files to Draft Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.setup.outputs.version }}
fail_on_unmatched_files: true
body: Liquibase ${{ needs.setup.outputs.version }}
generate_release_notes: true
draft: true
files: re-version/final/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}