Skip to content

Workflow file for this run

name: Publish to Cloudflare Pages
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
# Exclude pull requests from all repositories except yours
# See https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context
# See https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request
if: ${{ github.repository == 'rodrigoalcarazdelaosa/fisiquimicamente' }}
permissions:
contents: read
deployments: write
strategy:
matrix:
include:
- projectName: 'fisiquimicamente'
directory: 'public/es'
GoogleVerificationCode: GOOGLE_VERIFICATION_CODE_ES
PDFEmbedKey: PDF_EMBED_API_KEY_ES
- projectName: 'physichemically'
directory: 'public/en'
GoogleVerificationCode: GOOGLE_VERIFICATION_CODE_EN
PDFEmbedKey: PDF_EMBED_API_KEY_EN
- projectName: 'fisiquimicament'
directory: 'public/ca'
GoogleVerificationCode: GOOGLE_VERIFICATION_CODE_CA
PDFEmbedKey: PDF_EMBED_API_KEY_CA
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Fetch **all** history (not just deploy commit) for Hugo's .GitInfo and .Lastmod
# See https://discourse.gohugo.io/t/problems-with-gitinfo-in-ci/22480
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.1
- name: Download Hugo
run: wget https://github.com/gohugoio/hugo/releases/download/v${{ env.HUGO_VERSION }}/hugo_extended_${{ env.HUGO_VERSION }}_linux-amd64.deb -O hugo_extended_${{ env.HUGO_VERSION }}_linux-amd64.deb
# 0.103.0 began new naming convention
env:
HUGO_VERSION: 0.124.1
- name: Install Hugo
run: sudo dpkg -i hugo*.deb
- name: Cache Hugo resources
id: cache-hugo-resources
uses: actions/cache@v4
with:
path: resources
key: ${{ matrix.projectName }}-hugo-resources
- name: Build site with Hugo
run: source get_last_commit_hash.sh && hugo --gc
env:
HUGOxPARAMSxMARKETINGxVERIFICATIONxGOOGLE: ${{ secrets[matrix.GoogleVerificationCode] }}
HUGOxPARAMSxPDF_EMBED_API_KEY: ${{ secrets[matrix.PDFEmbedKey] }}
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ matrix.projectName }}
directory: ${{ matrix.directory }}
# Optional: Enable this if you want to have GitHub Deployments triggered
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# Enable Wrangler v3
wranglerVersion: '3'