Skip to content

Add a bit more to the readme #30

Add a bit more to the readme

Add a bit more to the readme #30

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
name: 'Test'
steps:
- name: 'Checkout repo'
uses: actions/checkout@v3
- name: 'Set up Node'
uses: actions/setup-node@v3
with:
node-version: 21.6.*
cache: npm
- name: 'Install dependencies'
run: npm ci
- name: 'Migrate'
run: npm run migrations:apply
- name: 'Run tests'
run: npm test
- name: 'Build app'
uses: cloudflare/wrangler-action@v3
with:
wranglerVersion: "3.28.2"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: deploy --outdir dist-app --dry-run
- name: 'Build auth'
uses: cloudflare/wrangler-action@v3
with:
wranglerVersion: "3.28.2"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: deploy --config wrangler-auth.toml --outdir dist-auth --dry-run
- name: 'Build worker'
uses: cloudflare/wrangler-action@v3
with:
wranglerVersion: "3.28.2"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: deploy --config wrangler-worker.toml --outdir dist-worker --dry-run
- name: 'Zip app'
run: zip -r app.zip dist-app public migrations wrangler.toml
- name: 'Zip auth'
run: zip -r auth.zip dist-auth wrangler-auth.toml
- name: 'Zip worker'
run: zip -r worker.zip dist-worker wrangler-worker.toml
- name: 'Save app artifact'
uses: actions/upload-artifact@v3
with:
name: app
path: app.zip
- name: 'Save auth artifact'
uses: actions/upload-artifact@v3
with:
name: auth
path: auth.zip
- name: 'Save worker artifact'
uses: actions/upload-artifact@v3
with:
name: worker
path: worker.zip
migrate:
name: 'Migrate database'
needs: [test]
runs-on: ubuntu-latest
steps:
- name: 'Download app'
uses: actions/download-artifact@v3
with:
name: app
- name: 'Unzip app artifact'
run: unzip app.zip
- name: 'Migrate database on Cloudflare'
uses: cloudflare/wrangler-action@v3
with:
wranglerVersion: "3.28.2"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: d1 migrations apply starter-db
deploy-app:
name: 'Deploy app'
needs: [migrate]
runs-on: ubuntu-latest
steps:
- name: 'Download app'
uses: actions/download-artifact@v3
with:
name: app
- name: 'Unzip app artifact'
run: unzip app.zip
- name: 'Deploy app to Cloudflare'
uses: cloudflare/wrangler-action@v3
with:
wranglerVersion: "3.28.2"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: deploy dist-app/index.js --no-bundle
deploy-auth:
name: 'Deploy auth'
needs: [migrate]
runs-on: ubuntu-latest
steps:
- name: 'Download auth'
uses: actions/download-artifact@v3
with:
name: auth
- name: 'Unzip auth artifact'
run: unzip auth.zip
- name: 'Deploy auth to Cloudflare'
uses: cloudflare/wrangler-action@v3
with:
wranglerVersion: "3.28.2"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: deploy --config wrangler-auth.toml dist-auth/auth.js --no-bundle
deploy-worker:
name: 'Deploy worker'
needs: [migrate]
runs-on: ubuntu-latest
steps:
- name: 'Download worker'
uses: actions/download-artifact@v3
with:
name: worker
- name: 'Unzip worker artifact'
run: unzip worker.zip
- name: 'Deploy worker to Cloudflare'
uses: cloudflare/wrangler-action@v3
with:
wranglerVersion: "3.28.2"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: deploy --config wrangler-worker.toml dist-worker/worker.js --no-bundle