-
Notifications
You must be signed in to change notification settings - Fork 271
184 lines (159 loc) · 7.58 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
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'
jobs:
release:
runs-on: ubuntu-22.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 v18
uses: actions/setup-node@v1
with:
node-version: 18
- name: Set up json CLI
run: npm install -g json
- name: Set up Gren
run: npm install -g github-release-notes
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@f6f458f535f4ccdf100400ee0755c0e857226a66
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Apicurio Registry Checkout
run: |
mkdir registry
cd registry
git init
git config --global user.name "apicurio-ci"
git config --global user.email "[email protected]"
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 --allow-same-version
cd ui-app
npm version $UI_VERSION --allow-same-version
json -I -f package.json -e "this.dependencies[\"@apicurio/apicurio-registry-sdk\"]=\"$UI_VERSION\""
cd ../ui-docs
npm version $UI_VERSION --allow-same-version
cd ../tests
npm version $UI_VERSION --allow-same-version
cd ../../typescript-sdk
npm version $UI_VERSION --allow-same-version
- name: Build Registry (All Variants)
run: |
cd registry
./mvnw clean package --no-transfer-progress -Pprod -DskipTests=true -DskipCommitIdPlugin=false -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5
- name: Build Registry UI
working-directory: registry/ui
run: |
npm install
npm run lint
npm run build
npm run package
- 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}-Dev')
cd ui
npm version $UI_VERSION --allow-same-version
cd ui-app
npm version $UI_VERSION --allow-same-version
json -I -f package.json -e "this.dependencies[\"@apicurio/apicurio-registry-sdk\"]=\"$UI_VERSION\""
cd ../ui-docs
npm version $UI_VERSION --allow-same-version
cd ../tests
npm version $UI_VERSION --allow-same-version
cd ../../typescript-sdk
npm version $UI_VERSION --allow-same-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 }}