Skip to content

Commit

Permalink
lets try deploying
Browse files Browse the repository at this point in the history
  • Loading branch information
swalker326 committed Aug 2, 2024
1 parent d2607ac commit e40d4cf
Showing 1 changed file with 28 additions and 87 deletions.
115 changes: 28 additions & 87 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:

jobs:
lint:
name: ⬣ ESLint
name: ⬣ Biome Check
runs-on: ubuntu-latest
steps:
- name: πŸ›‘ Cancel Previous Runs
Expand Down Expand Up @@ -68,98 +68,39 @@ jobs:
- name: πŸ”Ž Type check
run: pnpm run typecheck

# vitest:
# name: ⚑ Vitest
# runs-on: ubuntu-latest
# steps:
# - name: πŸ›‘ Cancel Previous Runs
# uses: styfle/[email protected]

# - name: ⬇️ Checkout repo
# uses: actions/checkout@v3

# - name: βŽ” Setup node
# uses: actions/setup-node@v3
# with:
# node-version: 16

# - name: πŸ“₯ Install pnpm
# uses: pnpm/action-setup@v2
# with:
# version: 6.32.9

# - name: πŸ“₯ Download deps
# run: pnpm install --frozen-lockfile

# - name: ⚑ Run vitest
# run: pnpm run test -- --coverage

# cypress:
# name: ⚫️ Cypress
# runs-on: ubuntu-latest
# steps:
# - name: πŸ›‘ Cancel Previous Runs
# uses: styfle/[email protected]

# - name: ⬇️ Checkout repo
# uses: actions/checkout@v3

# - name: πŸ„ Copy test env vars
# run: cp .env.example .env

# - name: βŽ” Setup node
# uses: actions/setup-node@v3
# with:
# node-version: 16

# - name: πŸ“₯ Install pnpm
# uses: pnpm/action-setup@v2
# with:
# version: 6.32.9

# - name: πŸ“₯ Download deps
# run: pnpm install --frozen-lockfile

# - name: πŸ›  Setup Database
# run: pnpm prisma migrate reset --force

# - name: βš™οΈ Build
# run: pnpm run build

# - name: 🌳 Cypress run
# uses: cypress-io/github-action@v5
# with:
# start: pnpm run start:mocks
# wait-on: "http://localhost:8811"
# env:
# PORT: "8811"

build:
name: 🐳 Build
deploy:
name: πŸš€ Deploy
runs-on: ubuntu-22.04
needs: [lint, typecheck]
# only build/deploy main branch on pushes
if: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- name: πŸ›‘ Cancel Previous Runs
uses: styfle/[email protected]
if:
${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') &&
github.event_name == 'push' }}

steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- 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@v2

# Setup cache
- name: ⚑️ Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
file: 'fly.toml'
field: 'app'

- name: 🎈 Setup Fly
uses: superfly/flyctl-actions/setup-flyctl@master

- name: πŸš€ Deploy Staging
if: ${{ github.ref == 'refs/heads/dev' }}
run:
flyctl deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }}
--app ${{ steps.app_name.outputs.value }}-staging
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

- name: πŸš€ Deploy Production
if: ${{ github.ref == 'refs/heads/main' }}
run: flyctl deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }}
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

0 comments on commit e40d4cf

Please sign in to comment.