Skip to content

Commit

Permalink
Configure production deployments
Browse files Browse the repository at this point in the history
Run production deployment on workflow dispatch
Run database configuration as part of deployments
Upgrade code quality environment from 18 to 20

closes #277
  • Loading branch information
TangoYankee committed Nov 6, 2024
1 parent 9d7b99b commit 765684c
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 🚧 Code quality
name: 🚧 Check code quality

on:
push:
Expand All @@ -15,7 +15,7 @@ jobs:
- name: set up node env
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x
- name: Install dependencies
run: npm ci
- name: Run lint
Expand All @@ -30,7 +30,7 @@ jobs:
- name: Set up node env
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x
- name: Install dependencies
run: npm ci
- name: Run unit tests
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Set up node env
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x
- name: Install dependencies
run: npm ci
- name: Run end to end tests
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: 🌠 Deploy to production

on: workflow_dispatch

jobs:
migrate:
name: 🧑‍🚀 Apply database migrations
environment:
name: production-zoning-api
runs-on: ubuntu-latest
env:
DATABASE_USER: ${{secrets.DATABASE_USER}}
DATABASE_PASSWORD: ${{secrets.DATABASE_PASSWORD}}
DATABASE_NAME: ${{secrets.DATABASE_NAME }}
DATABASE_PORT: ${{secrets.DATABASE_PORT}}
DATABASE_HOST: ${{secrets.DATABASE_HOST}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Configure database
run: npm run pg:configure
- name: Apply migrations
run: npm run drizzle:migrate
deploy:
name: 🚀 Deploy to production
environment:
name: production-zoning-api
url: https://zoning-api.nycplanningdigital.com
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy to Heroku
uses: akhileshns/[email protected]
with:
heroku_email: ${{secrets.HEROKU_EMAIL}}
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{secrets.HEROKU_APP_NAME}}
team: ${{secrets.HEROKU_TEAM}}
env:
HD_DATABASE_USER: ${{secrets.DATABASE_USER}}
HD_DATABASE_PASSWORD: ${{secrets.DATABASE_PASSWORD}}
HD_DATABASE_NAME: ${{secrets.DATABASE_NAME}}
HD_DATABASE_PORT: ${{secrets.DATABASE_PORT}}
HD_DATABASE_HOST: ${{secrets.DATABASE_HOST}}
HD_STORAGE_URL: ${{secrets.STORAGE_URL}}
HD_NODE_ENV: ${{secrets.NODE_ENV}}
10 changes: 6 additions & 4 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 🎭 Staging
name: 🎭 Deploy to staging

on:
push:
Expand All @@ -7,7 +7,7 @@ on:

jobs:
migrate:
name: 🧑‍🚀 Migrate
name: 🧑‍🚀 Apply database migrations
environment:
name: staging-zoning-api
runs-on: ubuntu-latest
Expand All @@ -23,13 +23,15 @@ jobs:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Configure database
run: npm run pg:configure
- name: Apply migrations
run: npm run drizzle:migrate
deploy:
name: 🚀 Deploy
name: 🚀 Deploy to staging
environment:
name: staging-zoning-api
url: https://staging-zoning-api.nycplanningdigital.com
Expand Down

0 comments on commit 765684c

Please sign in to comment.