Testing App Deployment #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Testing App Deployment | |
on: workflow_dispatch | |
env: | |
NODE_VERSION: 20.14.0 | |
jobs: | |
install: | |
name: 'Installing NPM modules' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: 'Caching NPM modules if necessary' | |
uses: actions/cache@v4 | |
id: node-modules-cache | |
with: | |
path: ./node_modules | |
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | |
- if: steps.node-modules-cache.outputs.cache-hit != 'true' | |
run: npm ci | |
lint: | |
name: 'Linting' | |
needs: install | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: 'Restoring NPM modules from cache' | |
uses: actions/cache@v4 | |
with: | |
path: ./node_modules | |
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | |
- run: npm run microfrontend-platform-testing-app:lint | |
build-platform: | |
name: 'Building Platform' | |
needs: install | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.microfrontend-platform-package-json.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: 'Restoring NPM modules from cache' | |
uses: actions/cache@v4 | |
with: | |
path: ./node_modules | |
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | |
- name: 'Reading package.json version of scion/microfrontend-platform' | |
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/package-json@master | |
id: microfrontend-platform-package-json | |
with: | |
path: projects/scion/microfrontend-platform/package.json | |
- name: 'Building @scion/microfrontend-platform' | |
run: npm run microfrontend-platform:build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
build-testing-app: | |
name: 'Building Testing App' | |
needs: build-platform | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: 'Restoring NPM modules from cache' | |
uses: actions/cache@v4 | |
with: | |
path: ./node_modules | |
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | |
- name: 'Downloading platform (dist)' | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- run: npm run microfrontend-platform-testing-app-vercel:build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: microfrontend-platform-testing-app-vercel | |
path: dist/microfrontend-platform-testing-app-vercel | |
deploy-testing-app: | |
name: 'Deploying Testing App' | |
needs: | |
- build-platform | |
- build-testing-app | |
- lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Downloading app: microfrontend-platform-testing-app-vercel (dist)' | |
uses: actions/download-artifact@v4 | |
with: | |
name: microfrontend-platform-testing-app-vercel | |
path: dist/microfrontend-platform-testing-app-vercel | |
- name: 'Deploying microfrontend-platform-testing-app to Vercel' | |
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master | |
with: | |
dist-folder: dist/microfrontend-platform-testing-app-vercel/browser | |
vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
org-id: ${{ secrets.VERCEL_ORG_ID }} | |
project-id: ${{ secrets.VERCEL_MICROFRONTEND_PLATFORM_TESTING_APP_PROJECT_ID }} | |
version: ${{ needs.build-platform.outputs.version }} | |
aliases: | | |
microfrontend-platform-testing-app.scion.vercel.app, | |
microfrontend-platform-testing-app1-v%v.scion.vercel.app, | |
microfrontend-platform-testing-app2-v%v.scion.vercel.app, | |
microfrontend-platform-testing-app3-v%v.scion.vercel.app, | |
microfrontend-platform-testing-app4-v%v.scion.vercel.app |