Bump actions/setup-node from 3 to 6 #145
Workflow file for this run
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: Main Workflow | |
| on: [push, pull_request] | |
| jobs: | |
| build_deploy_preview: | |
| name: Build & Deploy (Preview) | |
| runs-on: ubuntu-latest | |
| if: github.ref != 'refs/heads/main' && github.actor != 'dependabot[bot]' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '18' | |
| # @see https://www.voorhoede.nl/en/blog/super-fast-npm-install-on-github-actions/ | |
| - uses: actions/cache@v4 | |
| id: cache-node-modules | |
| with: | |
| path: ./node_modules | |
| key: ${{ runner.os }}-modules-${{ hashFiles('package-lock.json') }} | |
| - name: Install packages | |
| if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
| run: npm ci | |
| - uses: gacts/github-slug@v1 | |
| id: slug | |
| - run: | | |
| echo "BRANCH_NAME_SLUG=${{ steps.slug.outputs.branch-name-slug }}" >> $GITHUB_ENV | |
| echo "DEPLOY_URL=https://${{ steps.slug.outputs.branch-name-slug }}--inventage-tech-radar.netlify.app" >> $GITHUB_ENV | |
| echo "GITHUB_SHA_SHORT=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV | |
| - name: Build | |
| run: npm run build | |
| # Pin netlify-cli | |
| # @see https://github.com/netlify/cli/issues/6841 | |
| - name: Install netlify-cli | |
| shell: bash | |
| run: npm i -g netlify-cli@17.36.1 | |
| # Use netlify-cli for deployment | |
| # @see https://cli.netlify.com/commands/deploy/ | |
| - name: Deploy | |
| id: deploy | |
| run: | | |
| netlify deploy \ | |
| --alias ${{ env.BRANCH_NAME_SLUG }} \ | |
| --dir ./build \ | |
| --message 'Preview deployment for ${{ steps.slug.outputs.branch-name }} (${{ env.GITHUB_SHA_SHORT }})' \ | |
| --json true | |
| env: | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
| NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
| - name: Comment PR | |
| uses: thollander/actions-comment-pull-request@v3 | |
| if: ${{ github.event_name == 'pull_request' }} | |
| with: | |
| message: | | |
| Deployed to ${{ env.DEPLOY_URL }} | |
| comment-tag: deployment | |
| build_deploy: | |
| name: Build & Deploy | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' && github.actor != 'dependabot[bot]' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '18' | |
| # @see https://www.voorhoede.nl/en/blog/super-fast-npm-install-on-github-actions/ | |
| - uses: actions/cache@v3 | |
| id: cache-node-modules | |
| with: | |
| path: ./node_modules | |
| key: ${{ runner.os }}-modules-${{ hashFiles('package-lock.json') }} | |
| - name: Install packages | |
| if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Deploy | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./build | |
| cname: techradar.inventage.com |