Skip to content

Commit

Permalink
update github action
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinh · divn.dev committed Dec 2, 2023
1 parent 993dd42 commit 440c22e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [18.x]
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
DATABASE_URL: ${{ secrets.PREVIEW_DATABASE_URL }}
node: [20.x]

steps:
- uses: actions/checkout@v3
Expand All @@ -31,5 +28,11 @@ jobs:
- run: pnpm run typecheck

- run: pnpm run --filter @dinstack/api db:migrate
if: secrets.PREVIEW_DATABASE_URL
env:
DATABASE_URL: ${{ secrets.PREVIEW_DATABASE_URL }}

- run: pnpm run deploy:preview
if: secrets.CLOUDFLARE_API_TOKEN
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
12 changes: 8 additions & 4 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [18.x]
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
DATABASE_URL: ${{ secrets.PRODUCTION_DATABASE_URL }}
node: [20.x]

steps:
- uses: actions/checkout@v3
Expand All @@ -31,10 +28,17 @@ jobs:
- run: pnpm run typecheck

- run: pnpm run --filter @dinstack/api db:migrate
if: secrets.DATABASE_URL
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}

- run: pnpm run deploy:production
if: secrets.CLOUDFLARE_API_TOKEN
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

- uses: nathanvaughn/actions-cloudflare-purge@master
if: secrets.CLOUDFLARE_API_TOKEN && secrets.CLOUDFLARE_ZONE_ID
with:
cf_zone: ${{ secrets.CLOUDFLARE_ZONE_ID }}
cf_auth: ${{ secrets.CLOUDFLARE_API_TOKEN }}

0 comments on commit 440c22e

Please sign in to comment.