Skip to content

ci: provide manual deployment of TypeDoc #2015

ci: provide manual deployment of TypeDoc

ci: provide manual deployment of TypeDoc #2015

Workflow file for this run

name: Continuous Integration and Delivery
on: [push, pull_request, 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 lint
build-platform:
name: 'Building Platform'
needs: install
runs-on: ubuntu-latest
outputs:
version: ${{ steps.root-package-json.outputs.version }}
version-dasherized: ${{ steps.root-package-json.outputs.version-dasherized }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Reading package.json version of project root'
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/package-json@master
id: root-package-json
with:
path: package.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: 'Asserting package.json versions to be equal'
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/equality-checker@master
with:
values: |
${{ steps.root-package-json.outputs.version }},
${{ steps.microfrontend-platform-package-json.outputs.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: 'Building @scion/microfrontend-platform'
run: npm run microfrontend-platform:build
- name: 'Building API Documentation (TypeDoc)'
run: npm run microfrontend-platform:typedoc
- name: 'Building Reference Documentation (Developer Guide)'
run: npm run microfrontend-platform:adoc -- -a revnumber=${{ steps.root-package-json.outputs.version }} -a revnumber-dasherized=${{ steps.root-package-json.outputs.version-dasherized }}
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist
build-apps:
name: 'Building Apps'
needs: build-platform
runs-on: ubuntu-latest
strategy:
matrix:
app:
- name: microfrontend-platform-testing-app-vercel
cmd: npm run microfrontend-platform-testing-app-vercel:build
- name: microfrontend-platform-testing-app-ci
cmd: npm run microfrontend-platform-testing-app-ci:build
- name: microfrontend-platform-devtools-vercel
cmd: npm run microfrontend-platform-devtools-vercel:build
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
- name: 'Building ${{ matrix.app.name }}'
run: ${{ matrix.app.cmd }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.app.name }}
path: dist/${{ matrix.app.name }}
test:
name: 'Unit Testing'
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 test:headless
analyze:
name: 'Analyzing'
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') }}
- name: 'Analyzing ''@scion/microfrontend-platform'' bundle in client application'
run: npm run microfrontend-platform:analyze:assert
e2e:
name: 'E2E Testing'
needs: [build-platform, build-apps]
runs-on: ubuntu-latest
strategy:
matrix:
shard: [ 1/10, 2/10, 3/10, 4/10, 5/10, 6/10, 7/10, 8/10, 9/10, 10/10 ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Downloading platform (dist)'
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: 'Downloading app: microfrontend-platform-testing-app-ci (dist)'
uses: actions/download-artifact@v4
with:
name: microfrontend-platform-testing-app-ci
path: dist/microfrontend-platform-testing-app-ci
- 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 e2e:headless -- --shard=${{ matrix.shard }}
release-guard:
name: 'Should release?'
if: github.ref == 'refs/heads/master'
needs:
- build-platform
- build-apps
- lint
- test
- analyze
- e2e
runs-on: ubuntu-latest
outputs:
should-release: ${{ steps.tag-release-commit.outputs.is-release-commit }}
steps:
- uses: actions/checkout@v4
- name: 'If release commit present, add release tag'
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/tag-release-commit@master
id: tag-release-commit
with:
release-commit-message-pattern: 'release: v(.*)'
expected-version: ${{ needs.build-platform.outputs.version }}
release:
name: 'Releasing'
if: ${{ needs.release-guard.outputs.should-release == 'true' }}
needs: [release-guard, build-platform]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Downloading platform and documentation (dist)'
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- 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: 'Downloading app: microfrontend-platform-devtools-vercel (dist)'
uses: actions/download-artifact@v4
with:
name: microfrontend-platform-devtools-vercel
path: dist/microfrontend-platform-devtools-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
- name: 'Deploying microfrontend-platform-devtools to Vercel'
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master
with:
dist-folder: dist/microfrontend-platform-devtools-vercel/browser
vercel-token: ${{ secrets.VERCEL_TOKEN }}
org-id: ${{ secrets.VERCEL_ORG_ID }}
project-id: ${{ secrets.VERCEL_MICROFRONTEND_PLATFORM_DEVTOOLS_PROJECT_ID }}
version: ${{ needs.build-platform.outputs.version }}
aliases: |
microfrontend-platform-devtools.scion.vercel.app,
microfrontend-platform-devtools-v%v.scion.vercel.app
- name: 'Publishing API Documentation (TypeDoc) to Vercel'
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master
with:
dist-folder: dist/microfrontend-platform-api
vercel-token: ${{ secrets.VERCEL_TOKEN }}
org-id: ${{ secrets.VERCEL_ORG_ID }}
project-id: ${{ secrets.VERCEL_MICROFRONTEND_PLATFORM_API_PROJECT_ID }}
version: ${{ needs.build-platform.outputs.version }}
aliases: |
microfrontend-platform-api.scion.vercel.app,
microfrontend-platform-api-v%v.scion.vercel.app
- name: 'Publishing Reference Documentation (Developer Guide) to Vercel'
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master
with:
dist-folder: dist/microfrontend-platform-developer-guide
vercel-token: ${{ secrets.VERCEL_TOKEN }}
org-id: ${{ secrets.VERCEL_ORG_ID }}
project-id: ${{ secrets.VERCEL_MICROFRONTEND_PLATFORM_DEVELOPER_GUIDE_PROJECT_ID }}
version: ${{ needs.build-platform.outputs.version }}
aliases: |
microfrontend-platform-developer-guide.scion.vercel.app,
microfrontend-platform-developer-guide-v%v.scion.vercel.app
- name: 'Releasing @scion/microfrontend-platform to NPM'
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/npm-publish@master
with:
dist-folder: dist/scion/microfrontend-platform
npm-token: ${{ secrets.NPM_TOKEN }}
dry-run: false
- name: 'Creating GitHub Release'
run: gh release create $VERSION --title $VERSION --notes-file CHANGELOG_LATEST.md --verify-tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ needs.build-platform.outputs.version }}