Skip to content

fix: correct Cloudflare Pages deploy directory to dist #14

fix: correct Cloudflare Pages deploy directory to dist

fix: correct Cloudflare Pages deploy directory to dist #14

Workflow file for this run

# Workflow for deploying Nuxt site to Cloudflare Pages (Production)
# Triggered on pushes to the main branch
#
# Prerequisites — add these as GitHub repository secrets:
# CLOUDFLARE_API_TOKEN → API token with "Cloudflare Pages: Edit" permission
# CLOUDFLARE_ACCOUNT_ID → Your Cloudflare account ID (visible in dashboard sidebar)
# RESEND_API_KEY → Resend API key for the contact form email service
#
# Also update the `projectName` value below to match your Cloudflare Pages project name.
#
name: "[PROD] Deploy Nuxt site to Cloudflare Pages"
on:
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: read
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "cloudflare-production"
cancel-in-progress: false
jobs:
# Single build-and-deploy job — Cloudflare Pages action deploys directly
# from the build output, so a separate deploy job is not needed here
# (unlike GitHub Pages which requires upload-artifact → deploy-pages).
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
exit 0
else
echo "Unable to determine package manager"
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "24"
cache: ${{ steps.detect-package-manager.outputs.manager }}
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
- name: Build with Nuxt
run: ${{ steps.detect-package-manager.outputs.manager }} run build
env:
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
- name: Deploy to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: portfolio-website
directory: ./dist
branch: main