forked from apiman/apiman
-
Notifications
You must be signed in to change notification settings - Fork 0
277 lines (267 loc) · 14.5 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
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
name: Release Workflow
on:
pull_request:
branches: [master]
types: [closed]
paths:
- '.github/project.yaml'
jobs:
release:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && github.repository_owner == 'Apiman'
steps:
- name: Retrieve Project Metadata
uses: radcortez/project-metadata-action@master
id: metadata
with:
github-token: ${{secrets.GITHUB_TOKEN}}
metadata-file-path: '.github/project.yaml'
- name: Verify Metadata
run: |
if [ -z "${{steps.metadata.outputs.release-version}}" ]
then
echo "Failed to load project metadata from project.yaml!"
exit 1
else
echo "Releasing Apiman version ${{steps.metadata.outputs.release-version}}"
fi
- name: Set up Node.js v10
uses: actions/setup-node@v1
with:
node-version: 10
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Set up Gren
run: npm install github-release-notes -g
- name: Set up NPM CLI Login
run: npm install -g npm-cli-login
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v1
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Check Setup
run: |
pwd
mvn -version
- name: Set up settings.xml
run: |
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
# Checkout all repositories we're going to use for the release
- name: Apiman Code Checkout
run: |
mkdir apiman
cd apiman
git init
git config --global user.name "apiman-ci"
git config --global user.email "[email protected]"
git remote add origin "https://apiman-ci:${{ secrets.ACCESS_TOKEN }}@github.com/$GITHUB_REPOSITORY.git"
git fetch
git checkout master
git branch --set-upstream-to=origin/master
git pull
- name: Apiman Website Code Checkout
run: |
mkdir website
cd website
git init
git remote add origin "https://apiman-ci:${{ secrets.ACCESS_TOKEN }}@github.com/Apiman/apiman.github.io.git"
git fetch
git checkout master
git branch --set-upstream-to=origin/master
git pull
- name: Apiman Plugins Code Checkout
run: |
mkdir plugins
cd plugins
git init
git remote add origin "https://apiman-ci:${{ secrets.ACCESS_TOKEN }}@github.com/Apiman/apiman-plugins.git"
git fetch
git checkout master
git branch --set-upstream-to=origin/master
git pull
- name: Apiman Docker Code Checkout
run: |
mkdir docker
cd docker
git init
git remote add origin "https://apiman-ci:${{ secrets.ACCESS_TOKEN }}@github.com/Apiman/apiman-docker.git"
git fetch
git checkout master
git branch --set-upstream-to=origin/master
git pull
- name: Apiman Deployer Code Checkout
run: |
mkdir deployer
cd deployer
git init
git remote add origin "https://apiman-ci:${{ secrets.ACCESS_TOKEN }}@github.com/Apiman/apiman-deployer.git"
git fetch
git checkout master
git branch --set-upstream-to=origin/master
git pull
# Update all project versions to the version # being released
- name: Update Apiman Release Version ${{steps.metadata.outputs.release-version}} in pom.xml
run: cd apiman && mvn versions:set -DnewVersion=${{steps.metadata.outputs.release-version}} -DgenerateBackupPoms=false -DprocessAllModules=true
- name: Update Apiman Version in Plugins Project
run: cd plugins && sed -i "s/<version.apiman>.*<\/version.apiman>/<version.apiman>${{steps.metadata.outputs.release-version}}<\/version.apiman>/g" pom.xml
- name: Update Apiman Plugins Release Version ${{steps.metadata.outputs.release-version}} in pom.xml
run: cd plugins && mvn versions:set -DnewVersion=${{steps.metadata.outputs.release-version}} -DgenerateBackupPoms=false -DprocessAllModules=true
# Validate all builds
- name: Validating Apiman maven build
run: cd apiman && mvn clean install
- name: Validating Apiman Plugins maven build
run: cd plugins && mvn clean install
# Commit changes back to GitHub
- name: Commit Changes for Apiman Release Version ${{steps.metadata.outputs.release-version}}
run: |
cd apiman
git add .
git commit -m "Automated commit for Release Version: ${{steps.metadata.outputs.release-version}}"
git push
- name: Commit Changes for Apiman Plugins Release Version ${{steps.metadata.outputs.release-version}}
run: |
cd plugins
git add .
git commit -m "Automated commit for Release Version: ${{steps.metadata.outputs.release-version}}"
git push
- name: Update Apiman Deployer
run: |
cd deployer
sed -i "s/APIMAN_VERSION=.*$/APIMAN_VERSION=${{steps.metadata.outputs.release-version}}/g" deployer.sh
git add .
git commit -m "Automated commit for Release Version: ${{steps.metadata.outputs.release-version}}"
git push
git tag -a -m "Tagging release $RELEASE_VERSION" ${{steps.metadata.outputs.release-version}}
git push origin ${{steps.metadata.outputs.release-version}}
sed -i "s/APIMAN_VERSION=.*$/APIMAN_VERSION=${{steps.metadata.outputs.snapshot-version}}/g" deployer.sh
git add .
git commit -m "Update to next development version: ${{steps.metadata.outputs.snapshot-version}}"
git push
# Create GitHub "release" with attached assets
- name: Signing and Archiving the Quickstart ZIP
run: |
cd apiman
mkdir -p releases
cp distro/wildfly/target/apiman-distro-wildfly-${{steps.metadata.outputs.release-version}}-overlay.zip releases/.
cp distro/vertx/target/apiman-distro-vertx-${{steps.metadata.outputs.release-version}}.zip releases/.
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --passphrase-fd 0 --armor --detach-sign releases/apiman-distro-wildfly-${{steps.metadata.outputs.release-version}}-overlay.zip
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --passphrase-fd 0 --armor --detach-sign releases/apiman-distro-vertx-${{steps.metadata.outputs.release-version}}.zip
- name: Create GitHub Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{steps.metadata.outputs.release-version}}
release_name: ${{steps.metadata.outputs.release-version}}
- name: Upload WildFly Overlay Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing its ID to get its outputs object, which include a `upload_url`
asset_path: /home/runner/work/apiman/apiman/apiman/releases/apiman-distro-wildfly-${{steps.metadata.outputs.release-version}}-overlay.zip
asset_name: apiman-distro-wildfly-${{steps.metadata.outputs.release-version}}-overlay.zip
asset_content_type: application/zip
- name: Upload WildFly Overlay Asset (asc)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`
asset_path: /home/runner/work/apiman/apiman/apiman/releases/apiman-distro-wildfly-${{steps.metadata.outputs.release-version}}-overlay.zip.asc
asset_name: apiman-distro-wildfly-${{steps.metadata.outputs.release-version}}-overlay.zip.asc
asset_content_type: application/octet-stream
- name: Upload Vert.x Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing its ID to get its outputs object, which include a `upload_url`
asset_path: /home/runner/work/apiman/apiman/apiman/releases/apiman-distro-vertx-${{steps.metadata.outputs.release-version}}.zip
asset_name: apiman-distro-vertx-${{steps.metadata.outputs.release-version}}.zip
asset_content_type: application/zip
- name: Upload Vert.x Asset (asc)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`
asset_path: /home/runner/work/apiman/apiman/apiman/releases/apiman-distro-vertx-${{steps.metadata.outputs.release-version}}.zip.asc
asset_name: apiman-distro-vertx-${{steps.metadata.outputs.release-version}}.zip.asc
asset_content_type: application/octet-stream
- name: Generate Release Notes
run: cd apiman && gren release --token=${{ secrets.GITHUB_TOKEN }} --override
# Deploy Apiman to Maven Central
- name: Deploy Apiman to Maven Central
run: |
cd apiman
mvn deploy --batch-mode -DskipTests -T2C -Prelease --settings /home/runner/.m2/settings.xml
# Tag and release Apiman Plugins
- name: Tag and Release Apiman Plugins
run: |
cd plugins
git tag -a -m "Tagging release ${{steps.metadata.outputs.release-version}}" ${{steps.metadata.outputs.release-version}}
git push origin ${{steps.metadata.outputs.release-version}}
# Deploy Apiman Plugins to Maven Central
- name: Deploy Apiman Plugins to Maven Central
run: |
cd plugins
mvn deploy --batch-mode -DskipTests -T2C -Prelease --settings /home/runner/.m2/settings.xml
# Build and push new Docker images
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Building Docker Images
run: |
cd docker
docker build --build-arg "APIMAN_VERSION=${{steps.metadata.outputs.release-version}}" -t="apiman/on-wildfly" -t="apiman/on-wildfly:latest-release" -t="apiman/on-wildfly:${{steps.metadata.outputs.release-version}}" --rm on-wildfly/
docker build --build-arg "APIMAN_VERSION=${{steps.metadata.outputs.release-version}}" -t="apiman/vertx-openshift" -t="apiman/vertx-openshift:latest-release" -t="apiman/vertx-openshift:${{steps.metadata.outputs.release-version}}" --rm vertx-openshift/
docker build --build-arg "APIMAN_VERSION=${{steps.metadata.outputs.release-version}}" -t="apiman/vertx-standalone" -t="apiman/vertx-standalone:latest-release" -t="apiman/vertx-standalone:${{steps.metadata.outputs.release-version}}" --rm vertx-standalone/
- name: Push The Tagged Docker Images
run: |
cd docker
docker push apiman/on-wildfly:latest
docker push apiman/vertx-openshift:latest
docker push apiman/vertx-standalone:latest
docker push apiman/on-wildfly:latest-release
docker push apiman/vertx-openshift:latest-release
docker push apiman/vertx-standalone:latest-release
docker push apiman/on-wildfly:latest-release
docker push apiman/vertx-openshift:latest-release
docker push apiman/vertx-standalone:latest-release
docker push apiman/on-wildfly:${{steps.metadata.outputs.release-version}}
docker push apiman/vertx-openshift:${{steps.metadata.outputs.release-version}}
docker push apiman/vertx-standalone:${{steps.metadata.outputs.release-version}}
# Update project pom.xml files to next snapshot version and push to GH
- name: Update Apiman Next Snapshot Version ${{steps.metadata.outputs.snapshot-version}} in pom.xml
run: cd apiman && mvn versions:set -DnewVersion=${{steps.metadata.outputs.snapshot-version}} -DgenerateBackupPoms=false -DprocessAllModules=true
- name: Update Apiman Plugins Next Snapshot Version ${{steps.metadata.outputs.snapshot-version}} in pom.xml
run: cd plugins && mvn versions:set -DnewVersion=${{steps.metadata.outputs.snapshot-version}} -DgenerateBackupPoms=false -DprocessAllModules=true
- name: Commit Changes for Apiman Next Snapshot Version ${{steps.metadata.outputs.snapshot-version}}
run: |
cd apiman
git add .
git commit -m "Automated commit for Next Snapshot Version: ${{steps.metadata.outputs.snapshot-version}}"
git push
- name: Commit Changes for Apiman Plugins Next Snapshot Version ${{steps.metadata.outputs.snapshot-version}}
run: |
cd plugins
git add .
git commit -m "Automated commit for Next Snapshot Version: ${{steps.metadata.outputs.snapshot-version}}"
git push
# Update project website with new version
- name: Update Web Site
run: |
cd website
export PREV_VERSION=`cat version`
find ./latest/ -name '*.html' -exec sed -i "s/$PREV_VERSION/${{steps.metadata.outputs.release-version}}/g" {} \;
echo "${{steps.metadata.outputs.release-version}}" > version
git add .
git commit -m "Automated website update for Apiman release: ${{steps.metadata.outputs.release-version}}"
git push