Update angular-CI_CD.yml #25
Workflow file for this run
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Angular CI/CD | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
env: | |
PROJECT_DIR: dist/demo/browser | |
jobs: | |
build_test_merge: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [ 18.x ] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
- name: Create cache directories | |
run: mkdir -p ~/.cache/yarn && mkdir -p ${{ github.workspace }}/.yarn | |
- name: Cache Yarn dependencies | |
uses: actions/cache@v4 # this allows for re-using node_modules caching, making builds a bit faster. | |
with: | |
path: | | |
~/.cache/yarn | |
${{ github.workspace }}/.yarn | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Test library | |
run: yarn test:ci_cd | |
- name: Build demo - Step 01 | |
run: yarn gh-pages:build | |
- name: Build demo - Step 02 | |
run: yarn gh-pages:postbuild | |
- name: Deploy to gh-pages branch | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ${{ env.PROJECT_DIR }} | |
publish_branch: gh-pages | |
force_orphan: true |