Skip to content

Commit 70b1544

Browse files
committed
ci(workbench-testing-app): set up versioned deployment of testing app
Latest URL: https://workbench-testing-app.scion.vercel.app Versioned URL: https://workbench-testing-app-v18-0-0-beta-8.scion.vercel.app
1 parent 70cb418 commit 70b1544

File tree

7 files changed

+175
-24
lines changed

7 files changed

+175
-24
lines changed

.github/workflows/workflow.yml

Lines changed: 55 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,16 @@ jobs:
9595
cmd: npm run workbench-testing-app:basehref:build
9696
- name: workbench-testing-app-basehref-webpack
9797
cmd: npm run workbench-testing-app:basehref-webpack:build
98-
- name: workbench-testing-app-vercel
99-
cmd: npm run workbench-testing-app:vercel:build
98+
- name: workbench-testing-app-vercel-latest
99+
cmd: npm run workbench-testing-app:vercel-latest:build
100+
- name: workbench-testing-app-vercel-release
101+
cmd: npm run workbench-testing-app:vercel-release:build
102+
- name: workbench-client-testing-app-vercel-latest
103+
cmd: npm run workbench-client-testing-app:vercel-latest:build
104+
- name: workbench-client-testing-app-vercel-release
105+
cmd: npm run workbench-client-testing-app:vercel-release:build
100106
- name: workbench-client-testing-app-ci
101107
cmd: npm run workbench-client-testing-app:ci:build
102-
- name: workbench-client-testing-app-vercel
103-
cmd: npm run workbench-client-testing-app:vercel:build
104108
- name: workbench-getting-started-app
105109
cmd: npm run workbench-getting-started-app:build
106110
steps:
@@ -246,43 +250,78 @@ jobs:
246250
deploy-apps:
247251
name: 'Deploying Applications'
248252
if: github.ref == 'refs/heads/master'
249-
needs: [ workbench-release-guard, workbench-client-release-guard ]
253+
needs:
254+
- workbench-release-guard
255+
- workbench-client-release-guard
256+
- build-libs
250257
runs-on: ubuntu-latest
251258
steps:
252259
- uses: actions/checkout@v4
253-
- name: 'Downloading app: workbench-testing-app-vercel (dist)'
260+
- name: 'Downloading app: workbench-testing-app-vercel-latest (dist)'
261+
uses: actions/download-artifact@v4
262+
with:
263+
name: workbench-testing-app-vercel-latest
264+
path: dist/workbench-testing-app-vercel-latest
265+
- name: 'Downloading app: workbench-client-testing-app-vercel-latest (dist)'
266+
uses: actions/download-artifact@v4
267+
with:
268+
name: workbench-client-testing-app-vercel-latest
269+
path: dist/workbench-client-testing-app-vercel-latest
270+
- name: 'Downloading app: workbench-testing-app-vercel-release (dist)'
254271
uses: actions/download-artifact@v4
255272
with:
256-
name: workbench-testing-app-vercel
257-
path: dist/workbench-testing-app-vercel
258-
- name: 'Downloading app: workbench-client-testing-app-vercel (dist)'
273+
name: workbench-testing-app-vercel-release
274+
path: dist/workbench-testing-app-vercel-release
275+
- name: 'Downloading app: workbench-client-testing-app-vercel-release (dist)'
259276
uses: actions/download-artifact@v4
260277
with:
261-
name: workbench-client-testing-app-vercel
262-
path: dist/workbench-client-testing-app-vercel
278+
name: workbench-client-testing-app-vercel-release
279+
path: dist/workbench-client-testing-app-vercel-release
263280
- name: 'Downloading app: workbench-getting-started-app (dist)'
264281
uses: actions/download-artifact@v4
265282
with:
266283
name: workbench-getting-started-app
267284
path: dist/workbench-getting-started-app
268-
- name: 'Deploying workbench-testing-app to Vercel'
285+
- name: 'Deploying workbench-testing-app to Vercel (latest)'
269286
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master
270287
with:
271-
dist-folder: dist/workbench-testing-app-vercel/browser
288+
dist-folder: dist/workbench-testing-app-vercel-latest/browser
272289
vercel-token: ${{ secrets.VERCEL_TOKEN }}
273290
org-id: ${{ secrets.VERCEL_ORG_ID }}
274291
project-id: ${{ secrets.VERCEL_WORKBENCH_TESTING_APP_PROJECT_ID }}
275292
aliases: workbench-testing-app.scion.vercel.app
276-
- name: 'Deploying workbench-client-testing-app to Vercel'
293+
- name: 'Deploying workbench-client-testing-app to Vercel (latest)'
277294
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master
278295
with:
279-
dist-folder: dist/workbench-client-testing-app-vercel/browser
296+
dist-folder: dist/workbench-client-testing-app-vercel-latest/browser
280297
vercel-token: ${{ secrets.VERCEL_TOKEN }}
281298
org-id: ${{ secrets.VERCEL_ORG_ID }}
282299
project-id: ${{ secrets.VERCEL_WORKBENCH_CLIENT_TESTING_APP_PROJECT_ID }}
283300
aliases: |
284301
workbench-client-testing-app1.scion.vercel.app,
285-
workbench-client-testing-app2.scion.vercel.app,
302+
workbench-client-testing-app2.scion.vercel.app
303+
- name: 'Deploying workbench-testing-app to Vercel (release)'
304+
if: ${{ needs.workbench-release-guard.outputs.should-release == 'true' || needs.workbench-client-release-guard.outputs.should-release == 'true' }}
305+
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master
306+
with:
307+
dist-folder: dist/workbench-testing-app-vercel-release/browser
308+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
309+
org-id: ${{ secrets.VERCEL_ORG_ID }}
310+
project-id: ${{ secrets.VERCEL_WORKBENCH_TESTING_APP_PROJECT_ID }}
311+
version: ${{ needs.build-libs.outputs.workbench-version }}
312+
aliases: workbench-testing-app-v%v.scion.vercel.app
313+
- name: 'Deploying workbench-client-testing-app to Vercel (release)'
314+
if: ${{ needs.workbench-release-guard.outputs.should-release == 'true' || needs.workbench-client-release-guard.outputs.should-release == 'true' }}
315+
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master
316+
with:
317+
dist-folder: dist/workbench-client-testing-app-vercel-release/browser
318+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
319+
org-id: ${{ secrets.VERCEL_ORG_ID }}
320+
project-id: ${{ secrets.VERCEL_WORKBENCH_CLIENT_TESTING_APP_PROJECT_ID }}
321+
version: ${{ needs.build-libs.outputs.workbench-version }}
322+
aliases: |
323+
workbench-client-testing-app1-v%v.scion.vercel.app,
324+
workbench-client-testing-app2-v%v.scion.vercel.app
286325
- name: 'Deploying workbench-getting-started-app to Vercel'
287326
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master
288327
with:

angular.json

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@
251251
"scripts": []
252252
},
253253
"configurations": {
254-
"production-vercel": {
254+
"production-vercel-latest": {
255255
"budgets": [
256256
{
257257
"type": "initial",
@@ -267,11 +267,33 @@
267267
"fileReplacements": [
268268
{
269269
"replace": "apps/workbench-testing-app/src/environments/environment.ts",
270-
"with": "apps/workbench-testing-app/src/environments/environment.vercel.ts"
270+
"with": "apps/workbench-testing-app/src/environments/environment.vercel.latest.ts"
271271
}
272272
],
273273
"outputHashing": "all",
274-
"outputPath": "dist/workbench-testing-app-vercel"
274+
"outputPath": "dist/workbench-testing-app-vercel-latest"
275+
},
276+
"production-vercel-release": {
277+
"budgets": [
278+
{
279+
"type": "initial",
280+
"maximumWarning": "500kB",
281+
"maximumError": "1MB"
282+
},
283+
{
284+
"type": "anyComponentStyle",
285+
"maximumWarning": "2kB",
286+
"maximumError": "5kB"
287+
}
288+
],
289+
"fileReplacements": [
290+
{
291+
"replace": "apps/workbench-testing-app/src/environments/environment.ts",
292+
"with": "apps/workbench-testing-app/src/environments/environment.vercel.release.ts"
293+
}
294+
],
295+
"outputHashing": "all",
296+
"outputPath": "dist/workbench-testing-app-vercel-release"
275297
},
276298
"production-ci": {
277299
"budgets": [
@@ -481,7 +503,7 @@
481503
"scripts": []
482504
},
483505
"configurations": {
484-
"production-vercel": {
506+
"production-vercel-latest": {
485507
"budgets": [
486508
{
487509
"type": "initial",
@@ -497,11 +519,33 @@
497519
"fileReplacements": [
498520
{
499521
"replace": "apps/workbench-client-testing-app/src/environments/environment.ts",
500-
"with": "apps/workbench-client-testing-app/src/environments/environment.vercel.ts"
522+
"with": "apps/workbench-client-testing-app/src/environments/environment.vercel.latest.ts"
523+
}
524+
],
525+
"outputHashing": "all",
526+
"outputPath": "dist/workbench-client-testing-app-vercel-latest"
527+
},
528+
"production-vercel-release": {
529+
"budgets": [
530+
{
531+
"type": "initial",
532+
"maximumWarning": "500kB",
533+
"maximumError": "1MB"
534+
},
535+
{
536+
"type": "anyComponentStyle",
537+
"maximumWarning": "2kB",
538+
"maximumError": "5kB"
539+
}
540+
],
541+
"fileReplacements": [
542+
{
543+
"replace": "apps/workbench-client-testing-app/src/environments/environment.ts",
544+
"with": "apps/workbench-client-testing-app/src/environments/environment.vercel.release.ts"
501545
}
502546
],
503547
"outputHashing": "all",
504-
"outputPath": "dist/workbench-client-testing-app-vercel"
548+
"outputPath": "dist/workbench-client-testing-app-vercel-release"
505549
},
506550
"production-ci": {
507551
"budgets": [
File renamed without changes.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) 2018-2022 Swiss Federal Railways
3+
*
4+
* This program and the accompanying materials are made
5+
* available under the terms of the Eclipse Public License 2.0
6+
* which is available at https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*/
10+
11+
import packageJson from '../../../../projects/scion/workbench/package.json';
12+
13+
const version = packageJson.version.replace(/\./g, '-');
14+
15+
/**
16+
* Environment used when packaging the app for Vercel.
17+
*/
18+
export const environment = {
19+
animationEnabled: true,
20+
apps: {
21+
app1: {
22+
symbolicName: 'workbench-client-testing-app1',
23+
url: `https://workbench-client-testing-app1-v${version}.scion.vercel.app`,
24+
},
25+
app2: {
26+
symbolicName: 'workbench-client-testing-app2',
27+
url: `https://workbench-client-testing-app2-v${version}.scion.vercel.app`,
28+
},
29+
},
30+
};
File renamed without changes.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2018-2022 Swiss Federal Railways
3+
*
4+
* This program and the accompanying materials are made
5+
* available under the terms of the Eclipse Public License 2.0
6+
* which is available at https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*/
10+
11+
import {MicrofrontendPlatformConfig} from '@scion/microfrontend-platform';
12+
import {workbenchManifest} from '../app/workbench.manifest';
13+
import packageJson from '../../../../projects/scion/workbench/package.json';
14+
15+
const version = packageJson.version.replace(/\./g, '-');
16+
17+
/**
18+
* Environment used when packaging the app for Vercel.
19+
*/
20+
const microfrontendPlatformConfig: MicrofrontendPlatformConfig = {
21+
host: {
22+
symbolicName: 'workbench-host-app',
23+
manifest: workbenchManifest,
24+
},
25+
applications: [
26+
{symbolicName: 'workbench-client-testing-app1', manifestUrl: `https://workbench-client-testing-app1-v${version}.scion.vercel.app/manifest-app1.json`, intentionRegisterApiDisabled: false},
27+
{symbolicName: 'workbench-client-testing-app2', manifestUrl: `https://workbench-client-testing-app2-v${version}.scion.vercel.app/manifest-app2.json`, intentionRegisterApiDisabled: false},
28+
{symbolicName: 'devtools', manifestUrl: 'https://microfrontend-platform-devtools-v1-3-1.scion.vercel.app/manifest.json', intentionCheckDisabled: true, scopeCheckDisabled: true},
29+
],
30+
};
31+
32+
export const environment = {
33+
animationEnabled: true,
34+
logAngularChangeDetectionCycles: false,
35+
microfrontendPlatformConfig,
36+
};

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
"workbench-getting-started-app:serve": "ng serve workbench-getting-started-app --port 4500",
4747

4848
"workbench-testing-app:build": "ng build workbench-testing-app --configuration=development",
49-
"workbench-testing-app:vercel:build": "ng build workbench-testing-app --configuration=production-vercel",
49+
"workbench-testing-app:vercel-latest:build": "ng build workbench-testing-app --configuration=production-vercel-latest",
50+
"workbench-testing-app:vercel-release:build": "ng build workbench-testing-app --configuration=production-vercel-release",
5051
"workbench-testing-app:ci:build": "ng build workbench-testing-app --configuration=production-ci",
5152
"workbench-testing-app:basehref:build": "ng build workbench-testing-app --configuration=production-basehref",
5253
"workbench-testing-app:basehref-webpack:build": "ng run workbench-testing-app:build-basehref-webpack:production",
@@ -59,7 +60,8 @@
5960
"workbench-testing-app:basehref-webpack:http-server": "cd dist/workbench-testing-app-basehref-webpack && http-server --silent --port 4400",
6061

6162
"workbench-client-testing-app:build": "ng build workbench-client-testing-app --configuration=development",
62-
"workbench-client-testing-app:vercel:build": "ng build workbench-client-testing-app --configuration=production-vercel",
63+
"workbench-client-testing-app:vercel-latest:build": "ng build workbench-client-testing-app --configuration=production-vercel-latest",
64+
"workbench-client-testing-app:vercel-release:build": "ng build workbench-client-testing-app --configuration=production-vercel-release",
6365
"workbench-client-testing-app:ci:build": "ng build workbench-client-testing-app --configuration=production-ci",
6466
"workbench-client-testing-app:lint": "ng lint workbench-client-testing-app",
6567
"workbench-client-testing-app:4201:serve": "ng serve workbench-client-testing-app --port 4201",

0 commit comments

Comments
 (0)