diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index 9de49830..d0d4e3cf 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -1,4 +1,4 @@ -name: 🚧 Code quality +name: 🚧 Check code quality on: push: @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml new file mode 100644 index 00000000..6452a0a7 --- /dev/null +++ b/.github/workflows/production.yml @@ -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/heroku-deploy@v3.13.15 + 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}} diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 41dfa4cf..375c95f7 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -1,4 +1,4 @@ -name: 🎭 Staging +name: 🎭 Deploy to staging on: push: @@ -7,7 +7,7 @@ on: jobs: migrate: - name: 🧑‍🚀 Migrate + name: 🧑‍🚀 Apply database migrations environment: name: staging-zoning-api runs-on: ubuntu-latest @@ -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