Skip to content

Fix: deploy method with create first #4

Fix: deploy method with create first

Fix: deploy method with create first #4

name: Deploy to Cloudflare Pages
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Build
run: bun run build
- name: Ensure Pages project exists
run: |
echo "Attempting to create Cloudflare Pages project..."
bunx wrangler pages project create silryn-homepage --production-branch=main || echo "Project might already exist, continuing..."
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_PAGES_ACCOUNT }}
- name: Deploy to Cloudflare Pages
run: |
echo "Deploying to Cloudflare Pages..."
bunx wrangler pages deploy dist --project-name="silryn-homepage" --commit-dirty=true
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_PAGES_ACCOUNT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}