From 6476a87cd694e72ac61f423623831cd6dfec1383 Mon Sep 17 00:00:00 2001 From: Taui Silva Date: Wed, 20 Mar 2024 20:36:48 -0300 Subject: [PATCH] Update main.yaml --- .github/workflows/main.yaml | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 606f8b0..9d5b833 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -4,9 +4,6 @@ on: push: branches: - main - pull_request: - branches: - - main jobs: build: @@ -14,18 +11,40 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - + - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: 20 + - 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 }}- + cache-invalidation-period: 1d + + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: npm list + + - name: Install dependencies + run: npm ci + - name: Build Angular app to prod - run: npm i && npm run build:prod + run: npm run build:prod - name: Deploy to GitHub Pages uses: JamesIves/github-pages-deploy-action@v4 with: - folder: dist/browser - branch: prod token: ${{ secrets.TOKEN_GIT}} + folder: dist/browser + branch: gh-pages