Skip to content

Bump actions/setup-node from 3.8.1 to 4.0.0 #921

Bump actions/setup-node from 3.8.1 to 4.0.0

Bump actions/setup-node from 3.8.1 to 4.0.0 #921

Workflow file for this run

name: Deploy PR to Firebase
on:
pull_request:
types:
- opened
- synchronize
workflow_dispatch:
inputs:
prNumber:
description: 'Number of the PR to deploy'
required: true
jobs:
deploy-dev-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: false
- uses: actions/[email protected]
with:
node-version: 16
check-latest: true
cache: 'npm'
- name: Get Hugo Version
id: hugo-version
run: |
version=$(jq -r .hugo "scripts/.util/tools.json")
echo "version=${version#v}" >> "$GITHUB_OUTPUT"
- name: Checkout PR
if: github.event_name == 'workflow_dispatch'
run: |
gh pr checkout ${{ github.event.inputs.prNumber }}
env:
GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: ${{ steps.hugo-version.outputs.version }}
extended: true
- name: Install node Modules
run: npm ci
- name: Setup GCP Auth
id: auth
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Setup GCloud
uses: google-github-actions/[email protected]
with:
export_default_credentials: true
- name: Disable Crawling on staging site
run: |
printf "User-agent: *\nDissallow: /\n" > layouts/robots.txt
- name: Build
run: hugo
- name: Switch Back to Original Branch # Built contents in /public is unaffected
if: github.event_name == 'workflow_dispatch'
run: git checkout -
- name: Deploy
id: deploy
uses: actions/github-script@v7
with:
script: |
const deploy = require('./deploy.js')
await deploy({ expires: '72h' })
- name: Comment with Staging Link (by PR number)
if: github.event_name == 'workflow_dispatch'
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ github.event.inputs.prNumber }}
message: |
PR deployed to: ${{ steps.deploy.outputs.staging_url }}
Expires at: ${{ steps.deploy.outputs.expiration }}
- name: Comment with Staging Link
if: github.event_name != 'workflow_dispatch'
uses: marocchino/sticky-pull-request-comment@v2
with:
message: |
PR deployed to: ${{ steps.deploy.outputs.staging_url }}
Expires at: ${{ steps.deploy.outputs.expiration }}