Skip to content

Commit

Permalink
Configure deployment workflow
Browse files Browse the repository at this point in the history
Support deployments from main
Deploy to heroku and netlify from github actions
Require code quality checks to pass before deploying
Fix linting errors to pass quality checks

closes #1244

Co-authored-by: horatio <[email protected]>
  • Loading branch information
TangoYankee and horatiorosa committed Sep 19, 2024
1 parent 1d47553 commit 09ef261
Show file tree
Hide file tree
Showing 10 changed files with 359 additions and 8 deletions.
123 changes: 123 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: 🌠 Deploy to production

on: workflow_dispatch

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: 12.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 build
working-directory: client
- name: test
run: yarn test
working-directory: client
deploy-server:
name: 🚀 Deploy server
needs: test-client
environment:
name: production
url: https://applicants-api.nycplanningdigital.com
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
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_AUTHORITY_HOST_URL: ${{ secrets.AUTHORITY_HOST_URL }}
HD_CITYPAY_AGENCYID: ${{ secrets.CITYPAY_AGENCYID }}
HD_CITYPAY_CUSTOMER_LINK: ${{ secrets.CITYPAY_CUSTOMER_LINK }}
HD_CITYPAY_DOMAIN: ${{ secrets.CITYPAY_DOMAIN }}
HD_CITYPAY_PASSWORD: ${{ secrets.CITYPAY_PASSWORD }}
HD_CITYPAY_POSTBACK: ${{ secrets.CITYPAY_POSTBACK }}
HD_CITYPAY_RETURN_FROM_CART: ${{ secrets.CITYPAY_RETURN_FROM_CART }}
HD_CITYPAY_RETURN_FROM_CHECKOUT: ${{ secrets.CITYPAY_RETURN_FROM_CHECKOUT }}
HD_CITYPAY_USERNAME: ${{ secrets.CITYPAY_USERNAME }}
HD_CLIENT_ID: ${{ secrets.CLIENT_ID }}
HD_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
HD_CRM_HOST: ${{ secrets.CRM_HOST }}
HD_CRM_SERVICE_CONTACT_ID: ${{ secrets.CRM_SERVICE_CONTACT_ID }}
HD_CRM_URL_PATH: ${{ secrets.CRM_URL_PATH }}
HD_FIXIE_URL: ${{ secrets.FIXIE_URL }}
HD_MS_APPLICANT_PORTAL_PASSWORD: ${{ secrets.MS_APPLICANT_PORTAL_PASSWORD }}
HD_MS_APPLICANT_PORTAL_USERNAME: ${{ secrets.MS_APPLICANT_PORTAL_USERNAME }}
HD_NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY }}
HD_NEW_RELIC_LOG: ${{ secrets.NEW_RELIC_LOG }}
HD_NODE_ENV: ${{ vars.NODE_ENV }}
HD_NYCID_DOMAIN: ${{ secrets.NYCID_DOMAIN }}
HD_NYCID_SERVICE_ACCOUNT_USERNAME: ${{ secrets.NYCID_SERVICE_ACCOUNT_USERNAME }}
HD_NYCID_TOKEN_SECRET: ${{ secrets.NYCID_TOKEN_SECRET }}
HD_PAPERTRAIL_API_TOKEN: ${{ secrets.PAPERTRAIL_API_TOKEN }}
HD_PAYMENT_BASE_URL: ${{ secrets.PAYMENT_BASE_URL }}
HD_PAYMENT_IP_RANGE: ${{ secrets.PAYMENT_IP_RANGE }}
HD_PAYMENT_STEP1_URL: ${{ secrets.PAYMENT_STEP1_URL }}
HD_RER_FILETYPE_UUID: ${{ secrets.RER_FILETYPE_UUID }}
HD_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
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_TENANT_ID: ${{ secrets.TENANT_ID }}
HD_TOKEN_PATH: ${{ secrets.TOKEN_PATH }}
HD_ZAP_TOKEN_SECRET: ${{ secrets.ZAP_TOKEN_SECRET }}
deploy-client:
name: 🛫 Deploy client
needs: [test-client, deploy-server]
environment:
name: production
url: https://applicants.planning.nyc.gov
runs-on: ubuntu-latest
env:
HOST: ${{ vars.ZAP_API_HOST }}
MAINTENANCE_START: ${{ vars.MAINTENANCE_START }}
MAINTENANCE_END: ${{ vars.MAINTENANCE_END }}
HD_NYCID_DOMAIN: ${{ secrets.NYCID_DOMAIN }}
NODE_ENV: ${{ vars.NODE_ENV }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: client
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 12.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 \
--site ${{secrets.NETLIFY_SITE_ID}} \
--auth ${{secrets.NETLIFY_AUTH_TOKEN}} \
--message "${{ github.event.head_commit.message }}"
--prod
118 changes: 118 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: 🕵️ Deploy to quality assurance

on: workflow_dispatch

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: 12.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 build
working-directory: client
- name: test
run: yarn test
working-directory: client
deploy-server:
name: 🚀 Deploy server
needs: test-client
environment:
name: qa
url: https://qa-applicants-api.nycplanningdigital.com
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
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_AUTHORITY_HOST_URL: ${{ secrets.AUTHORITY_HOST_URL }}
HD_CITYPAY_AGENCYID: ${{ secrets.CITYPAY_AGENCYID }}
HD_CITYPAY_CUSTOMER_LINK: ${{ secrets.CITYPAY_CUSTOMER_LINK }}
HD_CITYPAY_DOMAIN: ${{ secrets.CITYPAY_DOMAIN }}
HD_CITYPAY_PASSWORD: ${{ secrets.CITYPAY_PASSWORD }}
HD_CITYPAY_POSTBACK: ${{ secrets.CITYPAY_POSTBACK }}
HD_CITYPAY_RETURN_FROM_CART: ${{ secrets.CITYPAY_RETURN_FROM_CART }}
HD_CITYPAY_RETURN_FROM_CHECKOUT: ${{ secrets.CITYPAY_RETURN_FROM_CHECKOUT }}
HD_CITYPAY_USERNAME: ${{ secrets.CITYPAY_USERNAME }}
HD_CLIENT_ID: ${{ secrets.CLIENT_ID }}
HD_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
HD_CRM_HOST: ${{ secrets.CRM_HOST }}
HD_CRM_SERVICE_CONTACT_ID: ${{ secrets.CRM_SERVICE_CONTACT_ID }}
HD_CRM_URL_PATH: ${{ secrets.CRM_URL_PATH }}
HD_FIXIE_URL: ${{ secrets.FIXIE_URL }}
HD_MS_APPLICANT_PORTAL_PASSWORD: ${{ secrets.MS_APPLICANT_PORTAL_PASSWORD }}
HD_MS_APPLICANT_PORTAL_USERNAME: ${{ secrets.MS_APPLICANT_PORTAL_USERNAME }}
HD_NODE_ENV: ${{ vars.NODE_ENV }}
HD_NYCID_SERVICE_ACCOUNT_USERNAME: ${{ secrets.NYCID_SERVICE_ACCOUNT_USERNAME }}
HD_NYCID_TOKEN_SECRET: ${{ secrets.NYCID_TOKEN_SECRET }}
HD_PAPERTRAIL_API_TOKEN: ${{ secrets.PAPERTRAIL_API_TOKEN }}
HD_PAYMENT_BASE_URL: ${{ secrets.PAYMENT_BASE_URL }}
HD_PAYMENT_IP_RANGE: ${{ secrets.PAYMENT_IP_RANGE }}
HD_PAYMENT_STEP1_URL: ${{ secrets.PAYMENT_STEP1_URL }}
HD_RER_FILETYPE_UUID: ${{ secrets.RER_FILETYPE_UUID }}
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_TENANT_ID: ${{ secrets.TENANT_ID }}
HD_TOKEN_PATH: ${{ secrets.TOKEN_PATH }}
HD_ZAP_TOKEN_SECRET: ${{ secrets.ZAP_TOKEN_SECRET }}
deploy-client:
name: 🛫 Deploy client
needs: [test-client, deploy-server]
environment:
name: staging
runs-on: ubuntu-latest
env:
HOST: ${{ vars.ZAP_API_HOST }}
MAINTENANCE_START: ${{ vars.MAINTENANCE_START }}
MAINTENANCE_END: ${{ vars.MAINTENANCE_END }}
NODE_ENV: ${{ vars.NODE_ENV }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: client
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 12.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 ${{github.ref_name}}_${{github.sha}} \
--site ${{secrets.NETLIFY_SITE_ID}} \
--auth ${{secrets.NETLIFY_AUTH_TOKEN}} \
--message "${{ github.event.head_commit.message }}"
109 changes: 109 additions & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
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: 12.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 build
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-applicants-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_AUTHORITY_HOST_URL: ${{ secrets.AUTHORITY_HOST_URL }}
HD_CLIENT_ID: ${{ secrets.CLIENT_ID }}
HD_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
HD_CRM_HOST: ${{ secrets.CRM_HOST }}
HD_CRM_SERVICE_CONTACT_ID: ${{ secrets.CRM_SERVICE_CONTACT_ID }}
HD_CRM_URL_PATH: ${{ secrets.CRM_URL_PATH }}
HD_FIXIE_URL: ${{ secrets.FIXIE_URL }}
HD_NODE_ENV: ${{ vars.NODE_ENV }}
HD_NYCID_SERVICE_ACCOUNT_USERNAME: ${{ secrets.NYCID_SERVICE_ACCOUNT_USERNAME }}
HD_NYCID_TOKEN_SECRET: ${{ secrets.NYCID_TOKEN_SECRET }}
HD_PAPERTRAIL_API_TOKEN: ${{ secrets.PAPERTRAIL_API_TOKEN }}
HD_RER_FILETYPE_UUID: ${{ secrets.RER_FILETYPE_UUID }}
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_TARGET_HOST: ${{ secrets.SHAREPOINT_TARGET_HOST }}
HD_TENANT_ID: ${{ secrets.TENANT_ID }}
HD_TOKEN_PATH: ${{ secrets.TOKEN_PATH }}
HD_ZAP_TOKEN_SECRET: ${{ secrets.ZAP_TOKEN_SECRET }}
deploy-client:
name: 🛫 Deploy client
needs: [test-client, deploy-server]
environment:
name: staging
url: https://staging--applicant-portal.netlify.app
runs-on: ubuntu-latest
env:
HOST: ${{ vars.ZAP_API_HOST }}
MAINTENANCE_START: ${{ vars.MAINTENANCE_START }}
MAINTENANCE_END: ${{ vars.MAINTENANCE_END }}
NODE_ENV: ${{ vars.NODE_ENV }}
steps:
- uses: actions/checkout@v4
with:
ref: 'main'
sparse-checkout: client
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 12.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 }}"
2 changes: 1 addition & 1 deletion client/app/adapters/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default class PackageAdapter extends JSONAPIAdapter {

const data = serializeIntoHash(store, type, snapshot);

let url = this.buildURL(type.modelName, snapshot.id, snapshot, 'updateRecord');
const url = this.buildURL(type.modelName, snapshot.id, snapshot, 'updateRecord');

return this.ajax(url, 'PATCH', { data });
}
Expand Down
4 changes: 2 additions & 2 deletions client/app/components/packages/landuse-form/housing-plans.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@
<form.Field
@attribute="dcpRestrictionsandconditionsdispositiontab"
@type="radio-group"
as |dcpRestrictionsandconditionsdispositiontabRadioGroup|>
<dcpRestrictionsandconditionsdispositiontabRadioGroup
as |DcpRestrictionsandconditionsdispositiontabRadioGroup|>
<DcpRestrictionsandconditionsdispositiontabRadioGroup
@options={{optionset 'landuseForm' 'dcpRestrictionsandconditionsdispositiontab' 'list'}}
/>
</form.Field>
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/packages/rwcds-form/edit.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="maintenance-wrapper notification-banner {{if isBannerClosed 'hide-banner'}}">
<div class="maintenance-wrapper notification-banner {{if this.isBannerClosed 'hide-banner'}}">
<div>
<FaIcon @icon="info-circle" @size="1x" id="information-icon"/>
<h4>Attention </h4>
Expand Down
2 changes: 1 addition & 1 deletion client/app/optionsets/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const COMMON_OPTIONSETS = {
YES_NO_PICKLIST_CODE,
YES_NO_DONT_KNOW,
YES_NO_INTEGER,
YES_NO_UNSURE_LONGINT
YES_NO_UNSURE_LONGINT,
};

export default COMMON_OPTIONSETS;
1 change: 1 addition & 0 deletions client/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module.exports = function(environment) {
APP: {
// Here you can pass flags/options to your application instance
// when it is created
showSelfService: false,
},

"labs-search": {
Expand Down
Loading

0 comments on commit 09ef261

Please sign in to comment.