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