Skip to content

Merge pull request #209 from coji/feat/durably-classify-job #1147

Merge pull request #209 from coji/feat/durably-classify-job

Merge pull request #209 from coji/feat/durably-classify-job #1147

Workflow file for this run

name: 🚀 Deploy
on:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
actions: write
contents: read
jobs:
lint:
name: ⬣ ESLint
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
name: Install pnpm
- name: ⎔ Setup node
uses: actions/setup-node@v6
with:
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: 🔬 Lint
run: pnpm run lint
format:
name: 💅 Prettier
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
name: Install pnpm
- name: ⎔ Setup node
uses: actions/setup-node@v6
with:
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: 💅 Format check
run: pnpm run format
typecheck:
name: ʦ TypeScript
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
name: Install pnpm
- name: ⎔ Setup node
uses: actions/setup-node@v6
with:
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build
- name: 🔎 Type check
run: pnpm run typecheck
vitest:
name: ⚡ Vitest
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v6
- name: 🏄 Copy test env vars
run: cp .env.example .env
- uses: pnpm/action-setup@v4
name: Install pnpm
- name: ⎔ Setup node
uses: actions/setup-node@v6
with:
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: 🛠 Install Atlas
run: curl -sSf https://atlasgo.sh | sh
- name: 🛠 Setup Database
run: pnpm db:setup
- name: 🔎 Check generated types are up to date
run: |
pnpm db:generate
git diff --exit-code app/services/type.ts app/services/tenant-type.ts || {
echo "::error::Generated DB types are out of date. Run 'pnpm db:generate' and commit the result."
exit 1
}
- name: ⚡ Run vitest
run: pnpm run test
build:
name: 🐳 Build
# only build/deploy main branch on pushes
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v6
- name: 👀 Read app name
uses: SebRollen/[email protected]
id: app_name
with:
file: 'fly.toml'
field: 'app'
- name: 🐳 Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: 🔑 Fly Registry Auth
uses: docker/login-action@v4
with:
registry: registry.fly.io
username: x
password: ${{ secrets.FLY_API_TOKEN }}
- name: 🐳 Docker build
uses: docker/build-push-action@v7
with:
context: .
push: true
tags: registry.fly.io/${{ steps.app_name.outputs.value }}:${{ github.ref_name }}-${{ github.sha }}
build-args: |
COMMIT_SHA=${{ github.sha }}
provenance: false
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
name: 🚀 Deploy
runs-on: ubuntu-latest
needs: [lint, format, typecheck, vitest, build]
# only build/deploy main branch on pushes
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v6
- name: 👀 Read app name
uses: SebRollen/[email protected]
id: app_name
with:
file: 'fly.toml'
field: 'app'
- name: 🚀 Deploy Production
uses: superfly/[email protected]
with:
args: 'deploy --image registry.fly.io/${{ steps.app_name.outputs.value }}:${{ github.ref_name }}-${{ github.sha }}'
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}