Move animations provider to library (#19) #6
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: Build and publish the example app | |
on: | |
push: | |
branches: | |
- 'master' | |
paths: | |
- 'package.json' | |
- 'angular.json' | |
- 'projects/cps-mdoc-viewer/src/**' | |
- 'projects/example-app/**' | |
- '.github/**' | |
jobs: | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ssh-key: ${{ secrets.DEPLOY_KEY }} | |
- name: Fetch latest commits | |
run: git pull origin master | |
- name: Use Node.js v20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
registry-url: 'https://registry.npmjs.org' | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install dependencies | |
run: npm ci | |
- name: Generate categories | |
working-directory: . | |
run: npm run generate-assets | |
- name: Commit and push if there are any changes in the categories | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git pull origin master | |
git add projects/cps-mdoc-viewer/src/assets-generator/generate-assets.js | |
if [[ -n "$(git status --porcelain | grep '^M')" ]]; then | |
git commit -m "Update autogenerated JSON file" | |
git push origin HEAD:master | |
fi | |
- name: Build CPS MDoc View Component Library | |
run: npm run build | |
- name: Build example app | |
run: npm run build:example-app | |
- name: Copy 404.html from source to dist | |
run: cp ./projects/example-app/src/404.html ./dist/example-app/browser/404.html | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: dist/example-app/browser | |
# Deploy job | |
deploy: | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# Specify runner + deployment step | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |