Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 5 additions & 33 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:
workflow_dispatch:

jobs:
build-and-test:
build-and-deploy:
runs-on: ubuntu-latest
name: Build and Test
name: Build and Deploy

steps:
- name: Checkout
Expand All @@ -33,51 +33,23 @@ jobs:
env:
NODE_ENV: production

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-output-${{ github.sha }}
path: .open-next

deploy:
runs-on: ubuntu-latest
name: Deploy to Production
needs: build-and-test
if: github.ref == 'refs/heads/main' && github.event_name == 'push'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-output-${{ github.sha }}
path: .open-next

- name: Run database migrations
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: npm run migrate
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
D1_DATABASE_ID: ${{ secrets.D1_DATABASE_ID }}

- name: Deploy to Cloudflare Pages
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: npm run deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

- name: Comment deployment URL
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: actions/github-script@v7
with:
script: |
Expand Down