Skip to content

fix(deploy): add deployments write permission to workflow #13

fix(deploy): add deployments write permission to workflow

fix(deploy): add deployments write permission to workflow #13

Workflow file for this run

name: Deploy to Cloudflare Pages
# This workflow deploys Blit-Tech Demos to Cloudflare Pages.
# The Blit-Tech library is cloned and built as a dependency,
# but is NOT tested here (it has its own CI in Blit-Tech repository).
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
quality:
name: Code Quality
runs-on: ubuntu-latest
steps:
- name: Checkout Blit-Tech library
uses: actions/checkout@v6
with:
repository: vancura/blit-tech
path: blit-tech
- name: Checkout Blit-Tech Demos
uses: actions/checkout@v6
with:
path: blit-tech-demos
- name: Create workspace config
run: |
cat > pnpm-workspace.yaml << EOF
packages:
- 'blit-tech'
- 'blit-tech-demos'
EOF
cp blit-tech/pnpm-lock.yaml pnpm-lock.yaml
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: '10.24.0'
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Build Blit-Tech library (dependency - not tested here)
run: |
cd blit-tech
pnpm build
- name: Check formatting (Blit-Tech Demos only)
run: |
cd blit-tech-demos
pnpm format:check
- name: Lint code (Blit-Tech Demos only)
run: |
cd blit-tech-demos
pnpm lint
- name: Type check (Blit-Tech Demos only)
run: |
cd blit-tech-demos
pnpm typecheck
build-library:
name: Build Blit-Tech Library
runs-on: ubuntu-latest
needs: quality
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
repository: vancura/blit-tech
path: blit-tech
- name: Checkout demos
uses: actions/checkout@v6
with:
path: blit-tech-demos
- name: Create workspace config
run: |
cat > pnpm-workspace.yaml << EOF
packages:
- 'blit-tech'
- 'blit-tech-demos'
EOF
cp blit-tech/pnpm-lock.yaml pnpm-lock.yaml
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: '10.24.0'
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Build Blit-Tech library
run: |
cd blit-tech
pnpm build
- name: Upload library artifacts
uses: actions/upload-artifact@v6
with:
name: blit-tech-library
path: blit-tech/dist/
retention-days: 1
build-demos:
name: Build Demos
runs-on: ubuntu-latest
needs: build-library
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
repository: vancura/blit-tech
path: blit-tech
- name: Checkout demos
uses: actions/checkout@v6
with:
path: blit-tech-demos
- name: Create workspace config
run: |
cat > pnpm-workspace.yaml << EOF
packages:
- 'blit-tech'
- 'blit-tech-demos'
EOF
cp blit-tech/pnpm-lock.yaml pnpm-lock.yaml
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: '10.24.0'
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Download library artifacts
uses: actions/download-artifact@v6
with:
name: blit-tech-library
path: blit-tech/dist/
- name: Build demos
run: |
cd blit-tech-demos
pnpm build
- name: Upload demos artifacts
uses: actions/upload-artifact@v6
with:
name: demos-dist
path: blit-tech-demos/dist/
retention-days: 7
deploy:
name: Deploy to Cloudflare Pages
runs-on: ubuntu-latest
needs: build-demos
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
permissions:
contents: read
deployments: write
steps:
- name: Download demos artifacts
uses: actions/download-artifact@v6
with:
name: demos-dist
path: dist/
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: blit-tech-demos
directory: dist
gitHubToken: ${{ secrets.GITHUB_TOKEN }}