-
Notifications
You must be signed in to change notification settings - Fork 276
236 lines (206 loc) · 9.9 KB
/
release.yaml
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
name: Release Workflow
on:
workflow_dispatch:
inputs:
release-version:
description: 'Version being released'
required: true
snapshot-version:
description: 'Next snapshot version'
required: true
branch:
description: 'Branch to release from'
required: true
default: 'main'
skip-maven-deploy:
description: 'Skip maven deploy'
required: true
default: 'false'
skip-python-sdk:
description: 'Skip python sdk deploy'
required: true
default: 'false'
jobs:
release:
runs-on: ubuntu-20.04
if: github.repository_owner == 'Apicurio'
env:
IS_PRE_RELEASE: false
steps:
- name: Log Metadata
run: |
echo "Releasing Apicurio Registry version ${{ github.event.inputs.release-version }} from branch ${{ github.event.inputs.branch }}"
echo "Next Snapshot version will be ${{ github.event.inputs.snapshot-version }}"
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set up Node.js v16
uses: actions/setup-node@v1
with:
node-version: 16
- name: Set up settings.xml
run: |
pwd
mkdir -p /home/runner/.m2
chmod 755 /home/runner/.m2
echo "<settings><servers><server><id>${{ secrets.OSSRH_ID }}</id><username>${{ secrets.OSSRH_USERNAME }}</username><password>${{ secrets.OSSRH_TOKEN }}</password></server></servers><profiles><profile><id>${{ secrets.OSSRH_ID }}</id><activation><activeByDefault>true</activeByDefault></activation><properties><gpg.executable>gpg</gpg.executable><gpg.passphrase>${{ secrets.GPG_PASSPHRASE}}</gpg.passphrase></properties></profile></profiles></settings>" > /home/runner/.m2/settings.xml
cat /home/runner/.m2/settings.xml
- name: Set up Gren
run: npm install github-release-notes -g
- name: Apicurio Registry Checkout
run: |
mkdir registry
cd registry
git init
git config --global user.name "apicurio-ci"
git config --global user.email "apicurio.ci@gmail.com"
git remote add origin "https://apicurio-ci:${{ secrets.ACCESS_TOKEN }}@github.com/Apicurio/apicurio-registry.git"
git fetch
git checkout ${{ github.event.inputs.branch }}
git branch --set-upstream-to=origin/${{ github.event.inputs.branch }}
git pull
- name: Update Release Version ${{ github.event.inputs.release-version}}
run: |
cd registry
mvn versions:set -DnewVersion=${{ github.event.inputs.release-version}} -DgenerateBackupPoms=false -DprocessAllModules=true
# take only the major and minor versions from release-version and then append .x.
DOCS_VERSION=$(echo "${{ github.event.inputs.release-version}}" | awk -F '.' '{print $1"."$2".x"}')
sed -i "s/version\:\s.*/version: \'${DOCS_VERSION}\'/g" docs/antora.yml
sed -i "5s/\"version\"\:\s\".*\"/\"version\": \"${DOCS_VERSION}\"/g" app/src/main/resources-unfiltered/META-INF/resources/api-specifications/registry/v3/openapi.json
# take only the major, minor and patch
PYTHON_SDK_VERSION=$(echo "${{ github.event.inputs.release-version}}" | awk -F '.' '{print $1"."$2"."$3}')
sed -i "s/^version.*/version \= \"${PYTHON_SDK_VERSION}\"/" python-sdk/pyproject.toml
# take only the major, minor and patch
UI_VERSION=$(echo "${{ github.event.inputs.release-version}}" | awk -F '.' '{print $1"."$2"."$3}')
cd ui
npm version $UI_VERSION
cd ui-app
npm version $UI_VERSION
cd ../ui-docs
npm version $UI_VERSION
cd ../tests
npm version $UI_VERSION
- name: Build Registry (All Variants)
run: |
cd registry
make SKIP_TESTS=true BUILD_FLAGS='-Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5' build-all
- name: Build Registry UI
run: |
cd registry/ui
npm install
npm run lint
npm run build
npm run package
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@f6f458f535f4ccdf100400ee0755c0e857226a66
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Maven Deploy
if: github.event.inputs.skip-maven-deploy == 'false'
run: |
cd registry
# Retry 3 times before the steps actually fails
(echo "===== Maven Deploy Attempt: 1 ====" && mvn deploy --batch-mode -Pprod -Psql -Pmssql -Pkafkasql -Prelease -DskipTests --settings /home/runner/.m2/settings.xml) || \
(echo "===== Maven Deploy Attempt: 2 ====" && mvn deploy --batch-mode -Pprod -Psql -Pmssql -Pkafkasql -Prelease -DskipTests --settings /home/runner/.m2/settings.xml) || \
(echo "===== Maven Deploy Attempt: 3 ====" && mvn deploy --batch-mode -Pprod -Psql -Pmssql -Pkafkasql -Prelease -DskipTests --settings /home/runner/.m2/settings.xml) || \
(echo "==== Maven Deploy Step Failed ====" && exit 1)
# Python SDK release
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Poetry
uses: snok/install-poetry@d45b6d76012debf457ab49dffc7fb7b2efe8071d
if: github.event.inputs.skip-python-sdk == 'false'
- name: Release Python SDK
run: |
cd registry
cd python-sdk
make publish
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
if: github.event.inputs.skip-python-sdk == 'false'
- name: Go - Setup Go
uses: actions/setup-go@v5
if: github.event.inputs.skip-go-sdk == 'false'
with:
go-version: '1.20'
# Needs special tagging to use submodules: https://stackoverflow.com/a/64705638/7898052
- name: Release Go SDK
run: |
cd registry
git tag "v${{ github.event.inputs.release-version }}"
git tag "go-sdk/v${{ github.event.inputs.release-version }}"
git push origin "v${{ github.event.inputs.release-version }}"
git push origin "go-sdk/v${{ github.event.inputs.release-version }}"
GOPROXY=proxy.golang.org go list -m "github.com/apicurio/apicurio-registry@v${{ github.event.inputs.release-version }}"
if: github.event.inputs.skip-go-sdk == 'false'
- name: Commit Release Version Change
run: |
cd registry
git add .
git commit -m "Automated update to Release Version:: ${{ github.event.inputs.release-version}}"
git push
- name: Determine Release Type
if: "contains(github.event.inputs.release-version, 'RC')"
run: |
echo "This is a pre-release. Setting environment variable 'IS_PRE_RELEASE' to true"
echo "IS_PRE_RELEASE=true" >> $GITHUB_ENV
- name: Create GitHub Release
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5
with:
name: ${{ github.event.inputs.release-version }}
tag_name: ${{ github.event.inputs.release-version }}
token: ${{ secrets.ACCESS_TOKEN }}
target_commitish: ${{ github.event.inputs.branch }}
prerelease: ${{ env.IS_PRE_RELEASE }}
files: |
registry/distro/docker/target/docker/app-files/apicurio-registry-app-${{ github.event.inputs.release-version }}-all.tar.gz
- name: Generate Release Notes
run: |
cd registry
gren release --token=${{ secrets.GITHUB_TOKEN }} --override
- name: Update Snapshot Version ${{ github.event.inputs.snapshot-version}}
run: |
cd registry
mvn versions:set -DnewVersion=${{ github.event.inputs.snapshot-version}} -DgenerateBackupPoms=false -DprocessAllModules=true
# take only the major and minor versions from snapshot-version and then append .x.
DOCS_VERSION=$(echo "${{ github.event.inputs.snapshot-version}}" | awk -F '.' '{print $1"."$2".x"}')
sed -i "s/version\:\s.*/version: \'${DOCS_VERSION}\'/g" docs/antora.yml
sed -i "5s/\"version\"\:\s\".*\"/\"version\": \"${DOCS_VERSION}\"/g" app/src/main/resources-unfiltered/META-INF/resources/api-specifications/registry/v3/openapi.json
# take only the major, minor and patch
PYTHON_SDK_VERSION=$(echo "${{ github.event.inputs.snapshot-version}}" | awk -F '.' '{print $1"."$2"."$3}')
sed -i "s/^version.*/version \= \"${PYTHON_SDK_VERSION}\"/" python-sdk/pyproject.toml
# take only the major, minor and patch
UI_VERSION=$(echo "${{ github.event.inputs.snapshot-version}}" | awk -F '.' '{print $1"."$2"."$3}')
cd ui
npm version $UI_VERSION
cd ui-app
npm version $UI_VERSION
cd ../ui-docs
npm version $UI_VERSION
cd ../tests
npm version $UI_VERSION
- name: Commit Snapshot Version ${{ github.event.inputs.snapshot-version}}
run: |
cd registry
git add .
git commit -m "Automated update to next Snapshot Version: ${{ github.event.inputs.snapshot-version}}"
git push
- name: Google Chat Notification (Always)
if: always()
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1
with:
name: ${{ github.job }}
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
status: ${{ job.status }}
- name: Google Chat Notification (Error)
if: failure()
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1
with:
name: ${{ github.job }}
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_ERRORS }}
status: ${{ job.status }}