-
Notifications
You must be signed in to change notification settings - Fork 73
349 lines (347 loc) · 16 KB
/
Copy pathrelease.yml
File metadata and controls
349 lines (347 loc) · 16 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
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
name: Vagrant HashiCorp Release
on:
repository_dispatch:
types:
- hashicorp-release
jobs:
vagrant-artifacts:
if: github.repository == 'hashicorp/vagrant-builders'
name: Build Core Vagrant Artifacts
permissions:
contents: write
uses: ./.github/workflows/vagrant-artifacts.yml
with:
vagrant-commit-id: ${{ github.event.client_payload.commit_id }}
info:
if: github.repository == 'hashicorp/vagrant-builders'
name: Validate Release Tag
runs-on: ubuntu-latest
outputs:
vagrant-tag: ${{ steps.validate.outputs.vagrant-tag }}
release-exists: ${{ steps.validate.outputs.release-exists }}
steps:
- name: Code Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Validate
id: validate
run: |
. ./.ci/load-ci.sh
if ! valid_release_version "${VAGRANT_TAG}"; then
failure "Invalid Vagrant release tag value (%s)" "${VAGRANT_TAG}"
fi
printf "vagrant-tag=%s\n" "${VAGRANT_TAG}" >> "${GITHUB_OUTPUT}"
if hashicorp_releases_exists "vagrant" "${VAGRANT_TAG#v}"; then
printf "release-exists=true\n" >> "${GITHUB_OUTPUT}"
fi
env:
VAGRANT_TAG: ${{ github.event.client_payload.tag }}
build-appimage-package:
if: github.repository == 'hashicorp/vagrant-builders'
name: Build appimage package
needs: [info, vagrant-artifacts]
permissions:
contents: write
id-token: write
uses: ./.github/workflows/build-appimage.yml
with:
vagrant-artifacts-name: ${{ needs.vagrant-artifacts.outputs.artifacts-name }}
vagrant-artifacts-path: ${{ needs.vagrant-artifacts.outputs.artifacts-path }}
vagrant-gem-name: ${{ needs.vagrant-artifacts.outputs.gem-name }}
vagrant-gem-path: ${{ needs.vagrant-artifacts.outputs.gem-path }}
vagrant-licenses-name: ${{ needs.vagrant-artifacts.outputs.licenses-name }}
vagrant-licenses-path: ${{ needs.vagrant-artifacts.outputs.licenses-path }}
vagrant-version: ${{ needs.vagrant-artifacts.outputs.vagrant-version }}
vagrant-shasum: ${{ needs.vagrant-artifacts.outputs.vagrant-shasum }}
secrets: inherit
build-archlinux-package:
if: github.repository == 'hashicorp/vagrant-builders'
name: Build Arch Linux Package
needs: [info, vagrant-artifacts]
permissions:
contents: write
id-token: write
uses: ./.github/workflows/build-arch.yml
with:
vagrant-artifacts-name: ${{ needs.vagrant-artifacts.outputs.artifacts-name }}
vagrant-artifacts-path: ${{ needs.vagrant-artifacts.outputs.artifacts-path }}
vagrant-gem-name: ${{ needs.vagrant-artifacts.outputs.gem-name }}
vagrant-gem-path: ${{ needs.vagrant-artifacts.outputs.gem-path }}
vagrant-version: ${{ needs.vagrant-artifacts.outputs.vagrant-version }}
vagrant-shasum: ${{ needs.vagrant-artifacts.outputs.vagrant-shasum }}
secrets: inherit
build-deb-packages:
if: github.repository == 'hashicorp/vagrant-builders'
name: Build deb packages
needs: [info, vagrant-artifacts]
permissions:
contents: write
id-token: write
uses: ./.github/workflows/build-debs.yml
with:
vagrant-artifacts-name: ${{ needs.vagrant-artifacts.outputs.artifacts-name }}
vagrant-artifacts-path: ${{ needs.vagrant-artifacts.outputs.artifacts-path }}
vagrant-gem-name: ${{ needs.vagrant-artifacts.outputs.gem-name }}
vagrant-gem-path: ${{ needs.vagrant-artifacts.outputs.gem-path }}
vagrant-version: ${{ needs.vagrant-artifacts.outputs.vagrant-version }}
vagrant-shasum: ${{ needs.vagrant-artifacts.outputs.vagrant-shasum }}
secrets: inherit
build-macos-package:
if: github.repository == 'hashicorp/vagrant-builders'
name: Build macOS package
needs: [info, vagrant-artifacts]
permissions:
contents: write
id-token: write
uses: ./.github/workflows/build-macos.yml
with:
vagrant-artifacts-name: ${{ needs.vagrant-artifacts.outputs.artifacts-name }}
vagrant-artifacts-path: ${{ needs.vagrant-artifacts.outputs.artifacts-path }}
vagrant-gem-name: ${{ needs.vagrant-artifacts.outputs.gem-name }}
vagrant-gem-path: ${{ needs.vagrant-artifacts.outputs.gem-path }}
vagrant-licenses-name: ${{ needs.vagrant-artifacts.outputs.licenses-name }}
vagrant-licenses-path: ${{ needs.vagrant-artifacts.outputs.licenses-path }}
vagrant-version: ${{ needs.vagrant-artifacts.outputs.vagrant-version }}
vagrant-shasum: ${{ needs.vagrant-artifacts.outputs.vagrant-shasum }}
secrets: inherit
build-rpm-packages:
if: github.repository == 'hashicorp/vagrant-builders'
name: Build rpm packages
needs: [info, vagrant-artifacts]
permissions:
contents: write
id-token: write
uses: ./.github/workflows/build-rpms.yml
with:
vagrant-artifacts-name: ${{ needs.vagrant-artifacts.outputs.artifacts-name }}
vagrant-artifacts-path: ${{ needs.vagrant-artifacts.outputs.artifacts-path }}
vagrant-gem-name: ${{ needs.vagrant-artifacts.outputs.gem-name }}
vagrant-gem-path: ${{ needs.vagrant-artifacts.outputs.gem-path }}
vagrant-version: ${{ needs.vagrant-artifacts.outputs.vagrant-version }}
vagrant-shasum: ${{ needs.vagrant-artifacts.outputs.vagrant-shasum }}
secrets: inherit
build-windows-packages:
if: github.repository == 'hashicorp/vagrant-builders'
name: Build Windows Packages
needs: [info, vagrant-artifacts]
permissions:
contents: write
id-token: write
uses: ./.github/workflows/build-windows.yml
with:
vagrant-artifacts-name: ${{ needs.vagrant-artifacts.outputs.artifacts-name }}
vagrant-artifacts-path: ${{ needs.vagrant-artifacts.outputs.artifacts-path }}
vagrant-gem-name: ${{ needs.vagrant-artifacts.outputs.gem-name }}
vagrant-gem-path: ${{ needs.vagrant-artifacts.outputs.gem-path }}
vagrant-licenses-name: ${{ needs.vagrant-artifacts.outputs.licenses-name }}
vagrant-licenses-path: ${{ needs.vagrant-artifacts.outputs.licenses-path }}
vagrant-version: ${{ needs.vagrant-artifacts.outputs.vagrant-version }}
vagrant-shasum: ${{ needs.vagrant-artifacts.outputs.vagrant-shasum }}
secrets: inherit
release:
if: github.repository == 'hashicorp/vagrant-builders' && needs.info.outputs.release-exists != 'true'
name: HashiCorp Release
needs: [info, vagrant-artifacts, build-appimage-package, build-archlinux-package, build-deb-packages, build-macos-package, build-rpm-packages, build-windows-packages]
runs-on: ['self-hosted', 'ondemand', 'linux', 'type=t3.small']
permissions:
id-token: write
contents: write
steps:
- name: Authentication
id: vault-auth
run: vault-auth
- name: Secrets
id: secrets
uses: hashicorp/vault-action@v2
with:
url: ${{ steps.vault-auth.outputs.addr }}
caCertificate: ${{ steps.vault-auth.outputs.ca_certificate }}
token: ${{ steps.vault-auth.outputs.token }}
secrets:
kv/data/github/hashicorp/vagrant-builders hashicorp_release_github_token;
kv/data/github/hashicorp/vagrant-builders releases_api_production_host;
kv/data/github/hashicorp/vagrant-builders releases_api_production_key;
kv/data/github/hashicorp/vagrant-builders releases_api_staging_host;
kv/data/github/hashicorp/vagrant-builders releases_api_staging_key;
kv/data/github/hashicorp/vagrant-builders signore_client_id;
kv/data/github/hashicorp/vagrant-builders signore_client_secret;
kv/data/github/hashicorp/vagrant-builders signore_gpg_signer;
- name: Code Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Doormat Configuration
uses: hashicorp/doormat-action@v1
with:
aws-role-arn: ${{ vars.RELEASE_ROLE_ARN }}
- name: Fetch appimage package
run: ./.ci/restore-cache "${CACHE_ID}" ./pkg
env:
CACHE_ID: ${{ needs.build-appimage-package.outputs.appimage-package-id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch Arch Linux package
run: ./.ci/restore-cache "${CACHE_ID}" ./pkg
env:
CACHE_ID: ${{ needs.build-archlinux-package.outputs.arch-package-id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch deb packages
run: ./.ci/restore-cache "${CACHE_ID}" ./pkg
env:
CACHE_ID: ${{ needs.build-deb-packages.outputs.deb-packages-id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch macOS DMG
run: ./.ci/restore-cache "${CACHE_ID}" ./pkg
env:
CACHE_ID: ${{ needs.build-macos-package.outputs.dmg-cache-id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch rpm packages
run: ./.ci/restore-cache "${CACHE_ID}" ./pkg
env:
CACHE_ID: ${{ needs.build-rpm-packages.outputs.rpm-packages-id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch 32 Bit Windows Package
run: ./.ci/restore-cache "${CACHE_ID}" ./pkg
env:
CACHE_ID: ${{ needs.build-windows-packages.outputs.msi-32-signed-id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch 64 Bit Windows Package
run: ./.ci/restore-cache "${CACHE_ID}" ./pkg
env:
CACHE_ID: ${{ needs.build-windows-packages.outputs.msi-64-signed-id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update macOS package name
run: ./.ci/macos-rename-release ./pkg
- name: Validate package list
run: ./.ci/validate-package-list ./pkg
- name: Release Packages
run: ./.ci/publish-release "${VAGRANT_VERSION}" ./pkg
env:
HASHIBOT_TOKEN: ${{ steps.secrets.outputs.hashicorp_release_github_token }}
VAGRANT_VERSION: ${{ needs.vagrant-artifacts.outputs.vagrant-version }}
SIGNORE_SIGNER: ${{ steps.secrets.outputs.signore_gpg_signer }}
SIGNORE_CLIENT_ID: ${{ steps.secrets.outputs.signore_client_id }}
SIGNORE_CLIENT_SECRET: ${{ steps.secrets.outputs.signore_client_secret }}
RELEASE_AWS_ACCESS_KEY_ID: ${{ steps.secrets.outputs.releases_aws_access_key_id }}
RELEASE_AWS_SECRET_ACCESS_KEY: ${{ steps.secrets.outputs.releases_aws_secret_access_key }}
RELEASE_AWS_ASSUME_ROLE_ARN: ${{ steps.secrets.outputs.releases_aws_role_arn }}
HC_RELEASES_PROD_SNS_TOPIC: ${{ vars.HASHICORP_RELEASES_SNS_ARN }}
HC_RELEASES_PROD_HOST: ${{ steps.secrets.outputs.releases_api_production_host }}
HC_RELEASES_PROD_KEY: ${{ steps.secrets.outputs.releases_api_production_key }}
HC_RELEASES_STAGING_HOST: ${{ steps.secrets.outputs.releases_api_staging_host }}
HC_RELEASES_STAGING_KEY: ${{ steps.secrets.outputs.releases_api_staging_key }}
HASHICORP_PUBLIC_GPG_KEY_ID: ${{ vars.HASHICORP_GPG_SIGNING_ID }}
post-release-github-release:
if: github.repository == 'hashicorp/vagrant-builders' && !cancelled() && !failure()
name: GitHub Release
needs: [info, vagrant-artifacts, release]
runs-on: ['self-hosted', 'ondemand', 'linux', 'type=t3.small']
permissions:
id-token: write
contents: write
steps:
- name: Authentication
id: vault-auth
run: vault-auth
- name: Secrets
id: secrets
uses: hashicorp/vault-action@v2
with:
url: ${{ steps.vault-auth.outputs.addr }}
caCertificate: ${{ steps.vault-auth.outputs.ca_certificate }}
token: ${{ steps.vault-auth.outputs.token }}
secrets:
kv/data/teams/vagrant/hashibot signore_token;
kv/data/teams/vagrant/hashibot vagrant_token;
kv/data/github/hashicorp/vagrant-builders signore_client_id;
kv/data/github/hashicorp/vagrant-builders signore_client_secret;
kv/data/github/hashicorp/vagrant-builders signore_gpg_signer;
- name: Code Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Fetch Vagrant Build Artifacts
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: ${{ needs.vagrant-artifacts.outputs.artifacts-name }}
path: ${{ needs.vagrant-artifacts.outputs.artifacts-path }}
- name: Checksum and Sign Vagrant Build Artifacts
run: ./.ci/generate-sign-build-sum "${VERSION}" "${ARTIFACT_DIR}"
env:
ARTIFACT_DIR: ${{ needs.vagrant-artifacts.outputs.artifacts-path }}
VERSION: ${{ needs.vagrant-artifacts.outputs.vagrant-version }}
GITHUB_TOKEN: ${{ steps.secrets.outputs.signore_token }}
SIGNORE_SIGNER: ${{ steps.secrets.outputs.signore_gpg_signer }}
SIGNORE_CLIENT_ID: ${{ steps.secrets.outputs.signore_client_id }}
SIGNORE_CLIENT_SECRET: ${{ steps.secrets.outputs.signore_client_secret }}
- name: Publish GitHub Release
run: ./.ci/publish-github-release "${TAG_NAME}" "${ARTIFACT_DIR}"
env:
ARTIFACT_DIR: ${{ needs.vagrant-artifacts.outputs.artifacts-path }}
TAG_NAME: ${{ needs.info.outputs.vagrant-tag }}
GITHUB_TOKEN: ${{ steps.secrets.outputs.vagrant_token }}
trigger-rubygem-publish:
if: github.repository == 'hashicorp/vagrant-builders' && !cancelled() && !failure()
name: Trigger RubyGem Publish
needs: [info, post-release-github-release]
runs-on: ['self-hosted', 'ondemand', 'linux', 'type=t3.small']
permissions:
id-token: write
contents: read
steps:
- name: Authentication
id: vault-auth
run: vault-auth
- name: Secrets
id: secrets
uses: hashicorp/vault-action@v2
with:
url: ${{ steps.vault-auth.outputs.addr }}
caCertificate: ${{ steps.vault-auth.outputs.ca_certificate }}
token: ${{ steps.vault-auth.outputs.token }}
secrets:
kv/data/teams/vagrant/hashibot publish_token;
- name: Code Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Trigger Publish
run: |
. .ci/load-ci.sh || exit
github_repository_dispatch "vagrant-publisher" "publish-rubygem" "repository_name=vagrant" "release_name=${RELEASE_NAME}"
env:
RELEASE_NAME: ${{ needs.info.outputs.vagrant-tag }}
GITHUB_TOKEN: ${{ steps.secrets.outputs.publish_token }}
unified-docs:
if: github.repository == 'hashicorp/vagrant-builders' && !cancelled() && !failure()
name: Create Unified Docs PR
needs: [info, vagrant-artifacts, release]
permissions:
contents: write
id-token: write
uses: ./.github/workflows/unified-docs-release.yml
with:
release-tag: ${{ needs.info.outputs.vagrant-tag }}
version: ${{ needs.vagrant-artifacts.outputs.vagrant-version }}
secrets: inherit
next-version:
if: github.repository == 'hashicorp/vagrant-builders' && !cancelled() && !failure()
name: Calculate next version
runs-on: ubuntu-latest
needs: [vagrant-artifacts]
outputs:
version: ${{ steps.calculate-version.outputs.version }}
steps:
- name: calculate-version
env:
current_version: ${{ needs.vagrant-artifacts.outputs.vagrant-version }}
run: |
major_minor="${current_version%.*}"
patch="${current_version##*.}"
((patch++))
new_version="${major_minor}.${patch}"
printf "version=%s\n" >> "${GITHUB_OUTPUT}"
new-unified-docs-version:
if: github.repository == 'hashicorp/vagrant-builders' && !cancelled() && !failure()
name: Add New Version To Docs
needs: [vagrant-artifacts, next-version, unified-docs]
permissions:
contents: write
id-token: write
uses: ./.github/workflows/unified-docs-new-version.yml
with:
new-version: ${{ needs.next-version.outputs.version }}
previous-version: ${{ needs.vagrant-artifacts.outputs.vagrant-version }}
secrets: inherit