-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
257 lines (254 loc) · 10.2 KB
/
deploy.yml
File metadata and controls
257 lines (254 loc) · 10.2 KB
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
name: Deploys
on:
workflow_dispatch:
inputs:
stable:
description: 'Use upstream stable build'
required: true
type: string
default: 'true'
version:
description: 'Specific Selenium version or release tag to use, e.g 4.42.1'
required: false
default: ''
release:
description: 'Deploy a new release'
required: false
type: string
default: 'true'
skip-test:
description: 'Skip the tests'
required: false
type: boolean
default: false
skip-commit:
description: 'Skip the commit'
required: false
type: boolean
default: false
skip-build-push-image:
description: 'Skip the build & push images'
required: false
type: boolean
default: false
build-date:
description: 'Build date'
required: false
type: string
default: ''
push:
branches:
- trunk
jobs:
build-test:
name: Build and Test
if: contains(toJson(github.event.commits), '[deploy]') == true || (github.event_name == 'workflow_dispatch' && github.event.inputs.skip-test == 'false')
uses: ./.github/workflows/build-test.yml
secrets: inherit
with:
release: ${{ github.event.inputs.stable || true }}
deploy:
needs:
- build-test
if: (contains(toJson(github.event.commits), '[deploy]') == true || (github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true')) && !failure() && !cancelled()
name: Deploy and Release
runs-on: ubuntu-24.04
permissions: write-all
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout code
uses: actions/checkout@main
with:
persist-credentials: false
fetch-depth: 0
- name: Set up containerd image store feature
uses: nick-invision/retry@master
with:
timeout_minutes: 10
max_attempts: 3
command: |
make setup_dev_env
- name: Output Docker info
run: docker info
- name: Set Selenium base version
uses: ./.github/actions/get-latest-upstream
with:
release: ${{ github.event.inputs.stable || true }}
version: ${{ github.event.inputs.version || '' }}
gh_cli_token: ${{ secrets.GITHUB_TOKEN }}
authors: ${{ vars.AUTHORS || github.repository_owner }}
- name: Sets build date
run: |
if [ -z "${BUILD_DATE}" ]; then
echo "BUILD_DATE=$(date '+%Y%m%d')" >> $GITHUB_ENV
else
echo "BUILD_DATE=${BUILD_DATE}" >> $GITHUB_ENV
fi
echo "NAME=${NAMESPACE}" >> $GITHUB_ENV
make set_build_multiarch
cat .env | xargs -I {} echo {} >> $GITHUB_ENV
env:
NAMESPACE: ${{ vars.DOCKER_NAMESPACE || 'selenium' }}
AUTHORS: ${{ vars.AUTHORS || github.repository_owner }}
BUILD_DATE: ${{ github.event.inputs.build-date || '' }}
- name: Sets prerelease to false by default
run: echo "PRERELEASE=false" >> $GITHUB_ENV
- name: Get Grid version
run: |
echo ${BASE_VERSION}
echo "GRID_VERSION=${BASE_VERSION}" >> $GITHUB_ENV
- name: Is it a prerelease?
run: echo "GRID_VERSION=${GRID_VERSION}-prerelease" >> $GITHUB_ENV && echo "PRERELEASE=true" >> $GITHUB_ENV
if: contains(toJson(github.event.commits), '[prerelease]') == true
- name: Display Grid version
run: echo ${GRID_VERSION}
- name: Sets env var for the next tag
run: echo "NEXT_TAG=${GRID_VERSION}-${BUILD_DATE}" >> $GITHUB_ENV
- name: Get latest tag
run: echo "LATEST_TAG=$(git tag --sort=-version:refname | grep "^[^selenium]" | head -n 1)" >> $GITHUB_ENV
- name: Display latest tag
run: echo ${LATEST_TAG}
- name: Update tag in docs and files
run: ./update_tag_in_docs_and_files.sh ${LATEST_TAG} ${NEXT_TAG}
- name: Update chart configuration docs
run: make generate_readme_charts
- name: Build Helm chart
uses: nick-invision/retry@master
with:
timeout_minutes: 5
max_attempts: 3
retry_wait_seconds: 10
command: |
SET_VERSION=false make chart_build
echo "CHART_PACKAGE_PATH=$(cat /tmp/selenium_chart_version)" >> $GITHUB_ENV
echo "CHART_FILE_NAME=$(basename $(cat /tmp/selenium_chart_version))" >> $GITHUB_ENV
- name: Render chart templates
run: |
make chart_render_template
echo "PUBLISH_YAML_MANIFESTS=$(find ./tests/tests -name "k8s_*.yaml" | tr '\n' ',')" >> $GITHUB_ENV
- name: Build images
if: github.event.inputs.skip-build-push-image != 'true'
uses: nick-invision/retry@master
with:
timeout_minutes: 180
max_attempts: 3
retry_wait_seconds: 60
command: PLATFORMS="${PLATFORMS}" VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} make build
- name: Login Docker Hub
run: docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
- name: Login GitHub Container Registry
if: github.event.inputs.skip-build-push-image != 'true'
run: echo "${{ secrets.SELENIUM_CI_TOKEN }}" | docker login ghcr.io -u "${{ secrets.SELENIUM_CI_USERNAME }}" --password-stdin
- name: Deploy new images
if: github.event.inputs.skip-build-push-image != 'true'
uses: nick-invision/retry@master
with:
timeout_minutes: 20
max_attempts: 5
retry_wait_seconds: 300
command: VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} make release
- name: Mirror versioned images to GHCR
if: github.event.inputs.skip-build-push-image != 'true'
uses: nick-invision/retry@master
with:
timeout_minutes: 30
max_attempts: 5
retry_wait_seconds: 300
command: GHCR_NAMESPACE="ghcr.io/$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')" VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} make release_ghcr
- name: Tag images as latest
if: github.event.inputs.skip-build-push-image != 'true'
run: VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} make tag_latest
- name: Deploy latest tag
if: github.event.inputs.skip-build-push-image != 'true'
uses: nick-invision/retry@master
with:
timeout_minutes: 20
max_attempts: 5
retry_wait_seconds: 300
command: VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} make release_latest
- name: Mirror latest images to GHCR
if: github.event.inputs.skip-build-push-image != 'true'
uses: nick-invision/retry@master
with:
timeout_minutes: 20
max_attempts: 5
retry_wait_seconds: 300
command: GHCR_NAMESPACE="ghcr.io/$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')" VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} make release_ghcr_latest
- name: Update package versions
run: make update_browser_versions_matrix
# make generate_latest_sbom
# make fetch_grid_scaler_resources
- name: Tag browser images
if: github.event.inputs.skip-build-push-image != 'true'
uses: nick-invision/retry@master
with:
timeout_minutes: 20
max_attempts: 5
retry_wait_seconds: 300
command: VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} PUSH_IMAGE=true make tag_and_push_browser_images
- name: Mirror browser images to GHCR
if: github.event.inputs.skip-build-push-image != 'true'
uses: nick-invision/retry@master
with:
timeout_minutes: 30
max_attempts: 5
retry_wait_seconds: 300
command: GHCR_NAMESPACE="ghcr.io/$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')" VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} make tag_and_push_browser_images_ghcr
- name: Delete previous nightly tag & release if any
uses: dev-drprasad/delete-tag-and-release@master
with:
tag_name: nightly
github_token: ${{ secrets.GITHUB_TOKEN }}
delete_release: true
- name: Commit files
if: env.LATEST_TAG != env.NEXT_TAG && github.event.inputs.skip-commit != 'true'
run: |
git config --local user.email "selenium-ci@users.noreply.github.com"
git config --local user.name "Selenium CI Bot"
git commit -m "[ci] Update tag ${RELEASE_TAG} in docs and files" -m "[skip test]" -a
git pull --rebase
env:
RELEASE_TAG: "${{ env.GRID_VERSION }}-${{ env.BUILD_DATE }}"
- name: Push changes
if: env.LATEST_TAG != env.NEXT_TAG && github.event.inputs.skip-commit != 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.SELENIUM_CI_TOKEN }}
branch: trunk
- name: Create release notes (release_notes.md)
run: ./generate_release_notes.sh ${LATEST_TAG} origin/trunk ${GRID_VERSION} ${BUILD_DATE}
- name: Upload release notes
uses: actions/upload-artifact@main
with:
name: release_notes
path: ./release_notes.md
if-no-files-found: ignore
- name: Create Release
if: env.LATEST_TAG != env.NEXT_TAG
id: create_release
uses: softprops/action-gh-release@v3.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: "${{ env.GRID_VERSION }}-${{ env.BUILD_DATE }}"
name: "${{ env.GRID_VERSION }}-${{ env.BUILD_DATE }}"
body_path: "release_notes.md"
generate_release_notes: true
prerelease: ${{ env.PRERELEASE }}
draft: false
append_body: false
discussion_category_name: "Announcements"
files: |
package_versions.txt
${{ env.PUBLISH_YAML_MANIFESTS }}