-
Notifications
You must be signed in to change notification settings - Fork 350
245 lines (212 loc) · 11 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
237
238
239
240
241
242
243
244
245
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: 'master'
jobs:
release:
runs-on: ubuntu-latest
if: github.repository_owner == 'Apiman'
env:
RELEASE_VERSION: ${{ github.event.inputs.release-version }}
DEV_VERSION: ${{ github.event.inputs.snapshot-version }}
steps:
- name: Set global git
run: |
git config --global user.name "apiman-ci"
git config --global user.email "ci.apiman@gmail.com"
# Checkout all repositories we're going to use for the release
- name: Check out Apiman
uses: actions/checkout@v3
with:
repository: apiman/apiman
ref: master
path: 'apiman'
lfs: true
submodules: false
token: ${{ secrets.ACCESS_TOKEN }}
- name: Submodule manual step
run: |
cd apiman
git submodule update --init --force --recursive
git submodule set-branch --branch various-work-for-release -- portal/ui
- name: Check out Apiman Plugins
uses: actions/checkout@v3
with:
repository: apiman/apiman-plugins
ref: master
path: 'plugins'
token: ${{ secrets.ACCESS_TOKEN }}
- name: Check out Default API Catalog Code
uses: actions/checkout@v3
with:
repository: apiman/apiman-api-catalog
ref: master
path: 'apiman-api-catalog'
token: ${{ secrets.ACCESS_TOKEN }}
- name: Check out Default Plugin Registry
uses: actions/checkout@v3
with:
repository: apiman/apiman-plugin-registry
ref: master
path: 'apiman-plugin-registry'
token: ${{ secrets.ACCESS_TOKEN }}
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: 'maven'
server-id: 'ossrh'
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v1
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
# Update all project versions to the version # being released
- name: Update Apiman *Parent* Release Version ${{ env.RELEASE_VERSION }} in pom.xml
run: |
cd apiman/parent
mvn -ntp clean install
mvn -ntp versions:set -DnewVersion="$RELEASE_VERSION" -DgenerateBackupPoms=false -DprocessAllModules=true
mvn -ntp clean install
- name: Update Apiman Release Version ${{ env.RELEASE_VERSION }} in pom.xml
run: |
cd apiman
mvn -ntp -N versions:update-parent -DparentVersion="[$RELEASE_VERSION]" -DgenerateBackupPoms=false
mvn -ntp versions:set -DnewVersion="$RELEASE_VERSION" -DgenerateBackupPoms=false -DprocessAllModules=true
mvn -ntp clean install
- name: Update Apiman Version in Plugins Project
run: |
cd plugins
sed -i "s/<version.apiman>.*<\/version.apiman>/<version.apiman>$RELEASE_VERSION<\/version.apiman>/g" pom.xml
- name: Update Apiman Plugins Release Version ${{ env.RELEASE_VERSION }} in pom.xml
run: |
cd plugins
mvn -ntp -N versions:update-parent -DparentVersion="[$RELEASE_VERSION]" -DgenerateBackupPoms=false
mvn -ntp versions:set -DnewVersion="$RELEASE_VERSION" -DgenerateBackupPoms=false -DprocessAllModules=true
mvn -ntp clean install
- name: Commit changes for Apiman Plugin Registry
run: |
cd apiman-plugin-registry
bash release.sh $RELEASE_VERSION $DEV_VERSION
- name: Commit changes for Apiman API Catalog
run: |
cd apiman-api-catalog
bash release.sh
- name: Update Registry and Catalog links in Apiman
run: |
find . -name "*.properties" -exec sed -i "s|apiman-manager.api-catalog.catalog-url=https://cdn.jsdelivr.net/gh/apiman/apiman-api-catalog@master/catalog.json|apiman-manager.api-catalog.catalog-url=https://cdn.jsdelivr.net/gh/apiman/apiman-api-catalog@$RELEASE_VERSION/catalog.json|" {} \;
find . -name "*.properties" -exec sed -i "s|apiman-manager.plugins.registries=https://cdn.jsdelivr.net/gh/apiman/apiman-plugin-registry@master/registry.json|apiman-manager.plugins.registries=https://cdn.jsdelivr.net/gh/apiman/apiman-plugin-registry@$RELEASE_VERSION/registry.json|" {} \;
# Commit changes back to GitHub
- name: Commit Changes for Apiman Release Version ${{ env.RELEASE_VERSION }}
run: |
cd apiman
git add .
git commit -m "Automated commit for Release Version: $RELEASE_VERSION"
git tag -f -a -m "Tagging release $RELEASE_VERSION" $RELEASE_VERSION
cd portal/ui
git add .
git commit -m "Automated commit for Release Version: $RELEASE_VERSION"
git tag -f -a -m "Tagging release $RELEASE_VERSION" $RELEASE_VERSION
cd ../..
git push --recurse-submodules=on-demand --atomic origin $RELEASE_VERSION:$RELEASE_VERSION
- name: Commit Changes for Apiman Plugins Release Version ${{ env.RELEASE_VERSION }}
run: |
cd plugins
git add .
git commit -m "Automated commit for Release Version: $RELEASE_VERSION"
git tag -f -a -m "Tagging release $RELEASE_VERSION" $RELEASE_VERSION
git push --atomic origin $RELEASE_VERSION:$RELEASE_VERSION
# Create GitHub "release" with attached assets
- name: Signing and Archiving the Quickstart ZIPs
run: |
cd apiman
mkdir -p releases
cp distro/wildfly/target/apiman-distro-wildfly-$RELEASE_VERSION-overlay.zip releases/.
cp distro/vertx/target/apiman-distro-vertx-$RELEASE_VERSION.zip releases/.
cp distro/tomcat/target/apiman-distro-tomcat-$RELEASE_VERSION-overlay.zip releases/.
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --passphrase-fd 0 --armor --detach-sign releases/apiman-distro-wildfly-$RELEASE_VERSION-overlay.zip
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --passphrase-fd 0 --armor --detach-sign releases/apiman-distro-vertx-$RELEASE_VERSION.zip
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --passphrase-fd 0 --armor --detach-sign releases/apiman-distro-tomcat-$RELEASE_VERSION-overlay.zip
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
with:
body_path: ${{ github.workspace }}/apiman/CHANGELOG.adoc
tag_name: ${{ github.event.inputs.release-version }}
name: ${{ github.event.inputs.release-version }}
prerelease: false
files: |
${{ github.workspace }}/apiman/releases/apiman-distro-wildfly-$RELEASE_VERSION-overlay.zip
${{ github.workspace }}/apiman/releases/apiman-distro-wildfly-$RELEASE_VERSION-overlay.zip.asc
${{ github.workspace }}/apiman/releases/apiman-distro-vertx-$RELEASE_VERSION.zip
${{ github.workspace }}/apiman/releases/apiman-distro-vertx-$RELEASE_VERSION.zip.asc
${{ github.workspace }}/apiman/releases/apiman-distro-tomcat-$RELEASE_VERSION-overlay.zip
${{ github.workspace }}/apiman/releases/apiman-distro-tomcat-$RELEASE_VERSION-overlay.zip.asc
# Deploy Apiman to Maven Central
- name: Deploy Apiman to Maven Central
run: |
cd apiman
mvn deploy --batch-mode -DskipTests -Prelease
cd parent
mvn deploy --batch-mode -DskipTests -Prelease
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
# Deploy Apiman Plugins to Maven Central
- name: Deploy Apiman Plugins to Maven Central
run: |
cd plugins
mvn deploy --batch-mode -DskipTests -Prelease --settings /home/runner/.m2/settings.xml
# Update project pom.xml files to next snapshot version and push to GH
- name: Update Apiman Parent Next Snapshot Version ${{ env.DEV_VERSION }} in pom.xml
run: |
cd apiman/parent
mvn -ntp versions:set -DnewVersion="$DEV_VERSION" -DgenerateBackupPoms=false -DprocessAllModules=true
- name: Update Apiman Next Snapshot Version ${{ env.DEV_VERSION }} in pom.xml
run: |
cd apiman
mvn -ntp versions:set -DnewVersion="$DEV_VERSION" -DgenerateBackupPoms=false -DprocessAllModules=true
mvn -ntp versions:update-parent -DparentVersion="[$DEV_VERSION]" -DgenerateBackupPoms=false -DallowSnapshots=true
find . -name "*.properties" -exec sed -i "s|apiman-manager.api-catalog.catalog-url=https://cdn.jsdelivr.net/gh/apiman/apiman-api-catalog@$RELEASE_VERSION/catalog.json|apiman-manager.api-catalog.catalog-url=https://cdn.jsdelivr.net/gh/apiman/apiman-api-catalog@master/catalog.json|" {} \;
find . -name "*.properties" -exec sed -i "s|apiman-manager.plugins.registries=https://cdn.jsdelivr.net/gh/apiman/apiman-plugin-registry@$RELEASE_VERSION/registry.json|apiman-manager.plugins.registries=https://cdn.jsdelivr.net/gh/apiman/apiman-plugin-registry@master/registry.json|" {} \;
- name: Update Apiman Plugins Next Snapshot Version ${{ env.DEV_VERSION }} in pom.xml
run: |
cd plugins
mvn -ntp versions:set -DnewVersion="$DEV_VERSION" -DgenerateBackupPoms=false -DprocessAllModules=true
mvn -ntp versions:update-parent -DparentVersion="[$DEV_VERSION]" -DgenerateBackupPoms=false -DallowSnapshots=true
- name: Commit Changes for Apiman Next Snapshot Version ${{ env.DEV_VERSION }}
run: |
cd apiman
git commit -am "Automated commit for Next Snapshot Version: $DEV_VERSION"
cd portal/ui
git commit -am "Automated commit for Next Snapshot Version: $DEV_VERSION"
cd ../..
git push --recurse-submodules=on-demand --atomic origin
- name: Commit Changes for Apiman Plugins Next Snapshot Version ${{ env.DEV_VERSION }}
run: |
cd plugins
git commit -am "Automated commit for Next Snapshot Version: $DEV_VERSION"
git push
- name: 'Send `apiman-release-version` repository dispatch event to `apiman/apiman-docker`'
uses: peter-evans/repository-dispatch@v1.1.3
with:
token: ${{ secrets.REPO_DISPATCH_ACCESS_TOKEN }}
repository: apiman/apiman-docker
event-type: apiman-release-version
client-payload: '{"release-version": "${{ github.events.inputs.release-version }}"}'