Skip to content

Commit

Permalink
Create angular-CI_CD.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
fsegurai authored Jun 5, 2024
1 parent 08a093d commit 891c571
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/angular-CI_CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# 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 Angular project
run: yarn test:ci_cd

- name: Build Angular project demo
run: yarn build:demo

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ env.PROJECT_DIR }}
publish_branch: gh-pages

0 comments on commit 891c571

Please sign in to comment.