-
Notifications
You must be signed in to change notification settings - Fork 201
264 lines (232 loc) · 9.64 KB
/
release-pipeline.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
name: OpenCue Release Pipeline
# Trigger this pipeline when a commit is tagged with a version number, e.g. "v0.4.32".
on:
push:
tags:
- "v*"
jobs:
preflight:
runs-on: ubuntu-22.04
name: Preflight
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set build ID
run: |
set -e
ci/generate_version_number.sh > VERSION
echo "Build ID: $(cat ./VERSION)"
echo "BUILD_ID=$(cat ./VERSION)" >> ${GITHUB_ENV}
- name: Get current tag name
run: echo "TAG_NAME=${GITHUB_REF/refs\/tags\//}" >> ${GITHUB_ENV}
- name: Verify tag name and version match
run: |
set -e
if [ "v$(cat VERSION)" != "${TAG_NAME}" ]; then
echo "Version check failed: code version v$(cat VERSION) does not match tag name ${TAG_NAME}"
echo "Original GITHUB_REF: ${GITHUB_REF}"
exit 1
fi
release_docker_images:
needs: preflight
runs-on: ubuntu-22.04
strategy:
matrix:
component: [cuebot, rqd, pycue, pyoutline, cuegui, cuesubmit, cueadmin]
name: Release ${{ matrix.component }} Docker image
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set build ID
run: |
set -e
ci/generate_version_number.sh > VERSION
echo "Build ID: $(cat ./VERSION)"
echo "BUILD_ID=$(cat ./VERSION)" >> ${GITHUB_ENV}
- name: Pull Docker image from staging
run: |
set -e
docker pull opencuebuild/${{ matrix.component }}:${BUILD_ID}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Rebuild and push Docker image
uses: docker/build-push-action@v3
with:
file: ${{ matrix.component }}/Dockerfile
tags: opencue/${{ matrix.component }}:${{ env.BUILD_ID }},opencue/${{ matrix.component }}:latest
context: .
push: true
# This step has been failing with permission issues.
# Commenting this out temporarily to unblock the release of v1.4
# - name: Docker Hub Description
# uses: peter-evans/dockerhub-description@v4
# with:
# username: ${{ secrets.DOCKER_USER }}
# password: ${{ secrets.DOCKER_PASS }}
# repository: opencue/${{ matrix.component }}
# readme-filepath: ./${{ matrix.component }}/README.md
create_release:
needs: preflight
name: Create Release
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.S3_REGION }}
role-to-assume: ${{ secrets.AWS_S3_ROLE }}
role-duration-seconds: 1800
- name: Set build ID
run: |
set -e
ci/generate_version_number.sh > VERSION
echo "Build ID: $(cat ./VERSION)"
echo "BUILD_ID=$(cat ./VERSION)" >> ${GITHUB_ENV}
- name: Fetch artifacts
id: fetch_artifacts
env:
S3_BUCKET: ${{ secrets.S3_BUCKET }}
run: |
mkdir -p "${GITHUB_WORKSPACE}/artifacts/"
aws s3 sync "s3://${S3_BUCKET}/opencue/${BUILD_ID}/" "${GITHUB_WORKSPACE}/artifacts/"
echo "filenames=$(ls "${GITHUB_WORKSPACE}/artifacts/" | xargs)" >> ${GITHUB_OUTPUT}
- name: List artifacts
run: |
echo ${{ steps.fetch_artifacts.outputs.filenames }}
- name: Generate release notes
id: release_notes
run: |
last_tagged_version=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1))
commits_since_last_release=$(git log --reverse --pretty="* %H %s" ${last_tagged_version}..HEAD)
# Use a delimiter to preserve the multiline string.
# See https://github.community/t/set-output-truncates-multiline-strings/16852
delimiter="$(openssl rand -hex 8)"
echo "commits<<${delimiter}" >> ${GITHUB_OUTPUT}
echo "${commits_since_last_release}" >> ${GITHUB_OUTPUT}
echo "${delimiter}" >> ${GITHUB_OUTPUT}
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.BUILD_ID }}
release_name: v${{ env.BUILD_ID }}
body: |
To learn how to install and configure OpenCue, see our [Getting Started guide](https://www.opencue.io/docs/getting-started/).
## Changes:
${{ steps.release_notes.outputs.commits }}
draft: true
prerelease: false
- name: Upload License
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/artifacts/LICENSE
asset_name: LICENSE
asset_content_type: application/octet-stream
- name: Upload Database Schema
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/artifacts/schema-${{ env.BUILD_ID }}.sql
asset_name: schema-${{ env.BUILD_ID }}.sql
asset_content_type: application/octet-stream
- name: Upload Demo Data
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/artifacts/seed_data-${{ env.BUILD_ID }}.sql
asset_name: seed_data-${{ env.BUILD_ID }}.sql
asset_content_type: application/octet-stream
- name: Upload Cuebot JAR
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/artifacts/cuebot-${{ env.BUILD_ID }}-all.jar
asset_name: cuebot-${{ env.BUILD_ID }}-all.jar
asset_content_type: application/octet-stream
- name: Upload Cuebot RPM
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/artifacts/opencue-cuebot-${{ env.BUILD_ID }}-1.noarch.rpm
asset_name: opencue-cuebot-${{ env.BUILD_ID }}-1.noarch.rpm
asset_content_type: application/octet-stream
- name: Upload RQD Tar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/artifacts/rqd-${{ env.BUILD_ID }}-all.tar.gz
asset_name: rqd-${{ env.BUILD_ID }}-all.tar.gz
asset_content_type: application/octet-stream
- name: Upload CueGUI Tar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/artifacts/cuegui-${{ env.BUILD_ID }}-all.tar.gz
asset_name: cuegui-${{ env.BUILD_ID }}-all.tar.gz
asset_content_type: application/octet-stream
- name: Upload PyCue Tar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/artifacts/pycue-${{ env.BUILD_ID }}-all.tar.gz
asset_name: pycue-${{ env.BUILD_ID }}-all.tar.gz
asset_content_type: application/octet-stream
- name: Upload PyOutline Tar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/artifacts/pyoutline-${{ env.BUILD_ID }}-all.tar.gz
asset_name: pyoutline-${{ env.BUILD_ID }}-all.tar.gz
asset_content_type: application/octet-stream
- name: Upload CueSubmit Tar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/artifacts/cuesubmit-${{ env.BUILD_ID }}-all.tar.gz
asset_name: cuesubmit-${{ env.BUILD_ID }}-all.tar.gz
asset_content_type: application/octet-stream
- name: Upload CueAdmin Tar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/artifacts/cueadmin-${{ env.BUILD_ID }}-all.tar.gz
asset_name: cueadmin-${{ env.BUILD_ID }}-all.tar.gz
asset_content_type: application/octet-stream