Skip to content

deploy api to production #5

deploy api to production

deploy api to production #5

Workflow file for this run

name: deploy api to production
on:
workflow_dispatch:
inputs:
dry-run:
description: Run the workflow without creating a deployment
required: false
default: false
type: boolean
push:
branches:
- main
# remove default permissions of GITHUB_TOKEN for security
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions: {}
jobs:
deploy:
runs-on: ubuntu-latest
if: github.repository_owner == 'mojisdev'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: setup pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
- name: setup node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: lts/*
- name: install dependencies
run: pnpm install --frozen-lockfile
- name: build
run: pnpm build
- name: lint
run: pnpm run lint
- name: typecheck
run: pnpm run typecheck
- name: test
run: pnpm run test
- name: deploy
if: ${{ github.event.inputs.dry-run != 'true' }}
uses: cloudflare/wrangler-action@6d58852c35a27e6034745c5d0bc373d739014f7f # v3.13.0
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
workingDirectory: .
environment: production
accountId: ${{ secrets.CF_ACCOUNT_ID }}