Skip to content

Update deploy.yaml

Update deploy.yaml #6

Workflow file for this run

name: Build and deploy to Cloudflare
on:
push:
branches: ["main"]
workflow_dispatch:
concurrency:
group: "pages"
cancel-in-progress: true
env:
BUILD_PATH: "."
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: ${{ env.BUILD_PATH }}/package-lock.json
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Install dependencies
run: npm ci
working-directory: ${{ env.BUILD_PATH }}
- name: Build with React Router
env:
DIRECTUS_API_KEY: ${{ secrets.DIRECTUS_API_KEY }}
DIRECTUS_WEB_URL: ${{ secrets.DIRECTUS_WEB_URL }}
run: npm run build
working-directory: ${{ env.BUILD_PATH }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.BUILD_PATH }}/build/client
deploy:
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
deployments: write
name: Deploy to Cloudflare Pages
steps:
- uses: actions/checkout@v4
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy ${{ env.BUILD_PATH }}/build/client --project-name=disto
# Optional: Enable this if you want to have GitHub Deployments triggered
gitHubToken: ${{ secrets.GITHUB_TOKEN }}