-
Notifications
You must be signed in to change notification settings - Fork 64
316 lines (271 loc) · 14.3 KB
/
create-release-candidate.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
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: Create Release Candidate
run-name: ${{ github.actor }} is executing Create Release Candidate
permissions:
contents: write
on:
workflow_dispatch:
inputs:
releasecandidatetag:
description: 'Release Candidate Tag'
default: 'RC0'
required: true
jobs:
createReleaseCandidate:
runs-on: ubuntu-22.04
steps:
- name: Init Release Candidate workflow
run: echo "Starting Apache ManifoldCF workflow for building ${{ github.event.inputs.releasecandidatetag }}"
- name: Checkout
uses: actions/[email protected]
- name: Set up OpenJDK 11 Temurin x64
uses: actions/[email protected]
with:
java-version: '11'
distribution: 'temurin'
architecture: x64
cache: maven
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Get Maven POM version
id: mavenProjectVersion
run: echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
- name: Initialize mandatory git config
env:
GH_TOKEN: ${{ github.token }}
run: |
git config user.name "$(gh api /users/${GITHUB_ACTOR} | jq .name -r)"
git config user.email ${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com
- name: Create Branch Version
id: branchVersion
run: |
currentMavenVersion="${{ steps.mavenProjectVersion.outputs.version }}"
suffixToRemove="SNAPSHOT"
branchVersion=${currentMavenVersion%"$suffixToRemove"}
echo "version=${branchVersion}" >> $GITHUB_OUTPUT
- name: Create Release Version
id: releaseVersion
run: |
branchVersionOutput=${{ steps.branchVersion.outputs.version }}
releaseVersion=${branchVersionOutput%"-"}
echo "version=${releaseVersion}" >> $GITHUB_OUTPUT
- name: Set Branch Tag output
id: branchTag
run: echo "tag=${{ steps.branchVersion.outputs.version }}${{ github.event.inputs.releasecandidatetag }}" >> $GITHUB_OUTPUT
- name: Create new release candidate branch
run: |
git branch release-${{ steps.branchTag.outputs.tag }}
git push --set-upstream origin release-${{ steps.branchTag.outputs.tag }}
git checkout release-${{ steps.branchTag.outputs.tag }}
- name: Update all the Maven modules with the new version
run: mvn versions:set -DnewVersion=${{ steps.mavenProjectVersion.outputs.version }} -DremoveSnapshot -DgenerateBackupPoms=false
- name: Update Ant script with the new RC version
run: sed -i 's/${{ steps.releaseVersion.outputs.version }}-dev/${{ steps.releaseVersion.outputs.version }}/g' build.xml;
- name: Update CHANGES.txt
run: sed -i 's/${{ steps.releaseVersion.outputs.version }}-dev/Release ${{ steps.releaseVersion.outputs.version }}/g' CHANGES.txt;
- name: Ant Build
run: ant make-core-deps make-deps image
- name: Maven Build
run: mvn clean install -B -DskipTests -DskipITs
- name: Update MCF version in the properties.xml files
run: |
sed -i 's/${{ steps.releaseVersion.outputs.version }}-dev/${{ steps.releaseVersion.outputs.version }}/g' dist/example/properties.xml;
sed -i 's/${{ steps.releaseVersion.outputs.version }}-dev/${{ steps.releaseVersion.outputs.version }}/g' dist/example-proprietary/properties.xml;
sed -i 's/${{ steps.releaseVersion.outputs.version }}-dev/${{ steps.releaseVersion.outputs.version }}/g' dist/multiprocess-file-example/properties.xml;
sed -i 's/${{ steps.releaseVersion.outputs.version }}-dev/${{ steps.releaseVersion.outputs.version }}/g' dist/multiprocess-file-example-proprietary/properties.xml;
- name: RAT licence checks
run: mvn -pl . apache-rat:check
- name: Generate RAT License Report
if: always()
run: |
echo -e "Printing RAT report\n"
cat target/rat.txt || true
- name: Commit and Push
run: |
find . -name 'pom.xml' -exec git add {} \;
git add CHANGES.txt build.xml
git commit -am "Create ${{ github.event.inputs.releasecandidatetag }} tag for MCF ${{ steps.mavenProjectVersion.outputs.version }}"
git push
- name: Create Release Candidate
id: create_release_candidate
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.branchTag.outputs.tag }}
release_name: Release Candidate ${{ steps.branchTag.outputs.tag }}
body: |
Release Candidate ${{ steps.branchTag.outputs.tag }}
draft: false
prerelease: true
- name: Set Artifact version output
id: artifactVersion
run: echo "version=${{ steps.branchVersion.outputs.version }}dev" >> $GITHUB_OUTPUT
- name: Rename KEYS and CHANGES.txt artifacts
run: |
cp KEYS apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}.KEYS
cp CHANGES.txt apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}.CHANGES.txt
- name: Upload artifacts - KEYS - text format
uses: actions/[email protected]
with:
name: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}.KEYS
path: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}.KEYS
- name: Upload Release Candidate Asset - KEYS
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release_candidate.outputs.upload_url }}
asset_path: ./apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}.KEYS
asset_name: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}.KEYS
asset_content_type: text/plain
- name: Upload artifacts - CHANGES
uses: actions/[email protected]
with:
name: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}.CHANGES.txt
path: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}.CHANGES.txt
- name: Upload Release Candidate Asset - CHANGES
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release_candidate.outputs.upload_url }}
asset_path: ./apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}.CHANGES.txt
asset_name: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}.CHANGES.txt
asset_content_type: text/plain
- name: Upload artifacts - Binary - zip format
uses: actions/[email protected]
with:
name: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-bin.zip
path: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-bin.zip
- name: Upload Release Candidate Asset - Binary - zip format
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release_candidate.outputs.upload_url }}
asset_path: ./apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-bin.zip
asset_name: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-bin.zip
asset_content_type: application/zip
- name: Upload artifacts - Binary - tar.gz format
uses: actions/[email protected]
with:
name: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-bin.tar.gz
path: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-bin.tar.gz
- name: Upload Release Candidate Asset - Binary - tar.gz format
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release_candidate.outputs.upload_url }}
asset_path: ./apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-bin.tar.gz
asset_name: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-bin.tar.gz
asset_content_type: application/gzip
- name: Upload artifacts - Lib - tar.gz format
uses: actions/[email protected]
with:
name: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-lib.tar.gz
path: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-lib.tar.gz
- name: Upload Release Candidate Asset - Lib - tar.gz format
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release_candidate.outputs.upload_url }}
asset_path: ./apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-lib.tar.gz
asset_name: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-lib.tar.gz
asset_content_type: application/gzip
- name: Upload artifacts - Lib - zip format
uses: actions/[email protected]
with:
name: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-lib.zip
path: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-lib.zip
- name: Upload Release Candidate Asset - Lib - zip format
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release_candidate.outputs.upload_url }}
asset_path: ./apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-lib.zip
asset_name: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-lib.zip
asset_content_type: application/zip
- name: Upload artifacts - Source code - tar.gz format
uses: actions/[email protected]
with:
name: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-src.tar.gz
path: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-src.tar.gz
- name: Upload Release Candidate Asset - Source code - tar.gz format
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release_candidate.outputs.upload_url }}
asset_path: ./apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-src.tar.gz
asset_name: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-src.tar.gz
asset_content_type: application/gzip
- name: Upload artifacts - Source code - zip format
uses: actions/[email protected]
with:
name: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-src.zip
path: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-src.zip
- name: Upload Release Candidate Asset - Source code - zip format
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release_candidate.outputs.upload_url }}
asset_path: ./apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-src.zip
asset_name: apache-manifoldcf-${{ steps.releaseVersion.outputs.version }}-src.zip
asset_content_type: application/zip
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/[email protected]
with:
images: apache/manifoldcf
labels: |
maintainer=Apache ManifoldCF Developers <[email protected]>
org.opencontainers.image.title=Apache ManifoldCF
org.opencontainers.image.description=Apache ManifoldCF is a multi-repository crawler framework, with multiple connectors.
org.opencontainers.image.vendor=Apache Software Foundation
org.opencontainers.image.ref.name=manifoldcf
org.opencontainers.image.authors=Apache ManifoldCF Developers <[email protected]>
org.opencontainers.image.url=https://hub.docker.com/r/apache/manifoldcf
org.opencontainers.image.source=https://github.com/apache/manifoldcf/blob/trunk/Dockerfile
org.opencontainers.image.documentation=https://hub.docker.com/r/apache/manifoldcf
org.opencontainers.image.version=${{ steps.branchTag.outputs.tag }}
org.opencontainers.image.licenses=Apache-2.0
- name: Update Docker Image tag
run: sed -i 's/SNAPSHOT/${{ github.event.inputs.releasecandidatetag }}/g' Dockerfile;
- name: Build and push ManifoldCF Docker Image
uses: docker/[email protected]
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64/v8
push: true
tags: apache/manifoldcf:latest,apache/manifoldcf:${{ steps.branchTag.outputs.tag }}
labels: ${{ steps.meta.outputs.labels }}