Merge pull request #1572 from nhsuk/dependabot/npm_and_yarn/npm_and_y… #267
This file contains hidden or 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
| name: Deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| install: | |
| name: Install dependencies | |
| runs-on: ubuntu-latest | |
| env: | |
| PUPPETEER_SKIP_DOWNLOAD: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| id: npm-install-cache | |
| with: | |
| lookup-only: true | |
| key: npm-install-${{ hashFiles('package-lock.json') }} | |
| path: node_modules | |
| - name: Setup Node | |
| if: steps.npm-install-cache.outputs.cache-hit != 'true' | |
| uses: actions/setup-node@v4 | |
| with: | |
| cache: 'npm' | |
| node-version-file: .nvmrc | |
| - name: Install dependencies | |
| if: steps.npm-install-cache.outputs.cache-hit != 'true' | |
| run: npm install | |
| build: | |
| name: Deploy | |
| runs-on: ubuntu-latest | |
| needs: [install] | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Restore dependencies | |
| uses: actions/cache/restore@v4 | |
| with: | |
| fail-on-cache-miss: true | |
| key: npm-install-${{ hashFiles('package-lock.json') }} | |
| path: node_modules | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .nvmrc | |
| - name: Build | |
| run: npm run build | |
| env: | |
| NODE_ENV: production | |
| - name: Upload GitHub Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: packages/nhsuk-frontend-review/dist | |
| - name: Deploy to GitHub Pages | |
| uses: actions/deploy-pages@v4 | |
| id: deployment |