Skip to content

Deploy site from main branch #40

Deploy site from main branch

Deploy site from main branch #40

Workflow file for this run

name: Site
on:
workflow_dispatch:
push:
branches:
- main
- next
paths:
- ".github/workflows/site.yml"
- "apps/site/**"
- "docs/**"
- "packages/**"
- "package-lock.json"
- "package.json"
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Node
uses: actions/setup-node@v5
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Build site
run: npm run site:build
- name: Ensure Cloudflare Pages production branch
run: |
curl --fail --silent --show-error --request PATCH \
"https://api.cloudflare.com/client/v4/accounts/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/pages/projects/chartkit-io" \
--header "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
--header "Content-Type: application/json" \
--data '{"production_branch":"main"}' \
--output /dev/null
- name: Deploy to Cloudflare Pages
id: cloudflare-pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
wranglerVersion: "4"
command: pages deploy apps/site/dist --project-name=chartkit-io --branch=${{ github.ref_name }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}