Skip to content

Workflow file for this run

name: site
on:
workflow_call:
inputs:
name:
required: true
type: string
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
name: Publish to Cloudflare Pages
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
working-directory: ${{ inputs.name }}
run: npm ci
# - name: Setup Hugo
# uses: peaceiris/actions-hugo@v2
# with:
# hugo-version: '0.123.7'
# extended: true
- name: Cache Hugo modules
uses: actions/cache@v4
with:
path: /tmp/hugo_cache/
key: ${{ runner.os }}-hugomod-${{ hashFiles(format('{0}/go.sum', inputs.name)) }}
restore-keys: |
${{ runner.os }}-hugomod-
# - name: Build
# working-directory: ${{ inputs.name }}
# run: |
# hugo --minify --gc --enableGitInfo
# - id: id
# run: >-
# echo "uid=$(id -u ${USER})" >> "$GITHUB_OUTPUT" &&
# echo "gid=$(id -g ${USER})" >> "$GITHUB_OUTPUT"
- name: Build
uses: addnab/docker-run-action@v3
with:

Check failure on line 64 in .github/workflows/site.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/site.yaml

Invalid workflow file

You have an error in your yaml syntax on line 64
image: hugomods/hugo:exts-0.123.7
options: >-
-v ${{ github.workspace }}:/src
-v /tmp/hugo_cache:/tmp/hugo_cache
# -u ${{steps.id.outputs.uid}}:${{steps.id.outputs.gid}}
-e GITHUB_TOKEN
run: >-
cd ${{ inputs.name }} && hugo --minify --gc --enableGitInfo
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Hugo Encrypt
working-directory: ${{ inputs.name }}
if: ${{ inputs.name == 'home' }}
run: |
curl -L -o hugo-encrypt "https://github.com/hugomods/encrypt/releases/download/v0.2.0/hugo-encrypt-linux-64"
chmod 755 hugo-encrypt
- name: Encrypt
working-directory: ${{ inputs.name }}
if: ${{ inputs.name == 'home' }}
run: |
chown -R $(id -u ${USER}):$(id -g ${USER}) -R public && ./hugo-encrypt
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ inputs.name == 'home' && 'hugomods' || (format('hugomods-{0}', inputs.name)) }}
directory: ./${{ inputs.name }}/public
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# - name: Publish Simplified Chinese Site to Cloudflare Pages
# uses: cloudflare/pages-action@v1
# with:
# apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
# accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
# projectName: hugomods-${{ inputs.name }}-zh-hans
# directory: ./${{ inputs.name }}/public/zh-hans
# gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# - name: Publish Traditional Chinese Site to Cloudflare Pages
# uses: cloudflare/pages-action@v1
# with:
# apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
# accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
# projectName: hugomods-${{ inputs.name }}-zh-hant
# directory: ./${{ inputs.name }}/public/zh-hant
# gitHubToken: ${{ secrets.GITHUB_TOKEN }}