Skip to content

Deploy site

Deploy site #44

Workflow file for this run

name: Deploy site
on:
workflow_dispatch:
inputs:
deploymentPassword:
description: 'Password for the deployment'
required: true
type: string
env:
DEPLOYMENT_CODE: ${{ secrets.DEPLOYMENT_CODE }}
jobs:
credentialCheck:
name: Credential Check
runs-on: ubuntu-latest
steps:
- name: Check credentials
if: ${{ env.DEPLOYMENT_CODE != inputs.deploymentPassword }}
run: exit 1
publish:
runs-on: ubuntu-latest
needs: [ credentialCheck ]
permissions:
contents: read
deployments: write
name: Publish to Cloudflare Pages
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Process Template
run: npm run process-template
- name: Run Build
run: npm run build
- name: Update timestamp
run: npm run update-timestamp
- name: Update CSS file path for 404.html
run: npm run update-css
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
directory: dist
# Optional: Enable this if you want to have GitHub Deployments triggered
# gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# Optional: Switch what branch you are publishing to.
# By default this will be the branch which triggered this workflow
branch: main
# Optional: Change the working directory
# workingDirectory: my-site
# Optional: Change the Wrangler version, allows you to point to a specific version or a tag such as `beta`
# wranglerVersion: '3'