Skip to content

docs: update README with project-specific documentation #22

docs: update README with project-specific documentation

docs: update README with project-specific documentation #22

name: Build and Deploy to CF Pages
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- name: Install dependencies
run: yarn install
- name: Build
run: EXPORT=true UNOPTIMIZED=true yarn build
env:
NODE_OPTIONS: '--max-old-space-size=4096'
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build-output
path: out/
deploy-preview:
needs: build
runs-on: ubuntu-latest
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) || github.event_name == 'workflow_dispatch'
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build-output
path: out/
- name: Deploy to Cloudflare Pages (Preview)
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: transchinese-test
directory: out
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
deploy-production:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build-output
path: out/
- name: Deploy to Cloudflare Pages (Production)
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: transchinese-org
directory: out
gitHubToken: ${{ secrets.GITHUB_TOKEN }}