name: Build and Deploy
on:
  push:
    branches:
      - master
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout 🛎️
        uses: actions/checkout@v3
      - uses: actions/setup-node@v1
        with:
          node-version: '18'
      - name: Clear npm cache
        run: npm cache clean -f
      - uses: actions/cache@v2
        with:
          path: ~/.npm
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node-
      - name: Install and Build 🔧
        run: |
          npm ci
          npm run build obelisco-angular-demo --configuration production
      - name: Deploy 🚀
        uses: peaceiris/actions-gh-pages@v3
        with:
          GITHUB_TOKEN: ${{ secrets.GH_ANGULAR_TOKEN }}
          branch: gh-pages
          folder: ./dist/obelisco-angular