Skip to content

Configure gh action deployments from main #26

Configure gh action deployments from main

Configure gh action deployments from main #26

Workflow file for this run

name: 🎭 Deploy to staging
on:
push:
branches:
- main
jobs:
test-client:
name: 🧪 Test client code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: client
- uses: actions/setup-node@v1
with:
node-version: 14.x
- name: install dependencies
run: yarn install --frozen-lockfile --non-interactive
working-directory: client
- name: build
env:
DISABLE_SOURCE_MAPS: true
BROCCOLI_ENV: production
run: yarn ember build -prod
working-directory: client
- name: test
run: yarn test
working-directory: client
deploy-server:
name: 🚀 Deploy server
needs: test-client
environment:
name: staging
url: https://staging-zap-api.nycplanningdigital.com
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: 'main'
sparse-checkout: server
- uses: akhileshns/[email protected]
name: Deploy server to Heroku
with:
heroku_email: ${{secrets.HEROKU_EMAIL}}
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{ vars.HEROKU_APP_NAME }}
team: ${{secrets.HEROKU_TEAM}}
appdir: server
env:
HD_ADO_PRINCIPAL: ${{secrets.ADO_PRINCIPAL}}
HD_AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }}
HD_AUTHORITY_HOST_URL: ${{secrets.AUTHORITY_HOST_URL}}
HD_CLIENT_ID: ${{secrets.CLIENT_ID}}
HD_CLIENT_SECRET: ${{secrets.CLIENT_SECRET}}
HD_CRM_ADMIN_SERVICE_USER: ${{secrets.CRM_ADMIN_SERVICE_USER}}
HD_CRM_HOST: ${{secrets.CRM_HOST}}
HD_CRM_SIGNING_SECRET: ${{secrets.CRM_SIGNING_SECRET}}
HD_CRM_URL_PATH: ${{secrets.CRM_URL_PATH}}
HD_NYCID_CONSOLE_PASSWORD: ${{secrets.NYCID_CONSOLE_PASSWORD}}
HD_PAPERTRAIL_API_TOKEN: ${{ secrets.PAPERTRAIL_API_TOKEN }}
HD_RECAPTCHA_SECRET_KEY: ${{secrets.RECAPTCHA_SECRET_KEY}}
HD_RECAPTCHA_SITE_KEY: ${{secrets.RECAPTCHA_SITE_KEY}}
HD_SHAREPOINT_CLIENT_ID: ${{secrets.SHAREPOINT_CLIENT_ID}}
HD_SHAREPOINT_CLIENT_SECRET: ${{secrets.SHAREPOINT_CLIENT_SECRET}}
HD_SHAREPOINT_CRM_SITE: ${{secrets.SHAREPOINT_CRM_SITE}}
HD_SHAREPOINT_SITE_ID: ${{secrets.SHAREPOINT_SITE_ID}}
HD_SHAREPOINT_TARGET_HOST: ${{secrets.SHAREPOINT_TARGET_HOST}}
HD_SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
HD_TENANT_ID: ${{secrets.TENANT_ID}}
HD_TOKEN_PATH: ${{secrets.TOKEN_PATH}}
deploy-client:
name: 🛫 Deploy client
needs: [test-client, deploy-server]
environment:
name: staging
url: https://staging--labs-zap.netlify.app
runs-on: ubuntu-latest
env:
HOST: ${{ vars.ZAP_API_HOST }}
NYCID_CLIENT_ID: ${{ vars.NYCID_CLIENT_ID}}
NYC_ID_HOST: ${{ vars.NYC_ID_HOST}}
MAINTENANCE_START: ${{ vars.MAINTENANCE_START }}
MAINTENANCE_END: ${{ vars.MAINTENANCE_END }}
steps:
- uses: actions/checkout@v4
with:
ref: 'main'
sparse-checkout: client
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 14.x
- name: Install application dependencies
working-directory: client
run: yarn install --immutable --immutable-cache --check-cache
- name: Build client
working-directory: client
run: yarn run build --environment=production
- name: Install netlify
# Use npm over yarn because yarn was not respecting the exact version of a dependency
run: npm i -g [email protected]
- name: Deploy client to Netlify
run: |
netlify deploy \
--dir client/dist \
--alias staging \
--site ${{secrets.NETLIFY_SITE_ID}} \
--auth ${{secrets.NETLIFY_AUTH_TOKEN}} \
--message "${{ github.event.head_commit.message }}"