-
Notifications
You must be signed in to change notification settings - Fork 2
183 lines (166 loc) · 8.89 KB
/
dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# This is a basic workflow to help you get started with Actions
name: Dev Deploy
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the develop branch
push:
branches: [develop]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Set default working directory for all jobs to /app
defaults:
run:
working-directory: ./app
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
environment: dev
# Set environment variables
env:
APP_NAME: csb-dev
CLOUD_SPACE: dev
CF_ORG: epa-avert
CF_SPACE: csb-dev
CF_USER_DEV: ${{ secrets.CF_USER_DEV }}
CF_PASSWORD_DEV: ${{ secrets.CF_PASSWORD_DEV }}
SERVER_URL: https://app-dev.app.cloud.gov/csb
SERVER_BASE_PATH: /csb
SAML_LOGIN_URL: ${{ secrets.SAML_LOGIN_URL }}
SAML_LOGOUT_URL: ${{ secrets.SAML_LOGOUT_URL }}
SAML_ENTITY_ID: ${{ secrets.SAML_ENTITY_ID }}
SAML_IDP_CERT: ${{ secrets.SAML_IDP_CERT }}
SAML_PUBLIC_KEY: ${{ secrets.SAML_PUBLIC_KEY }}
# SAML_PRIVATE_KEY: ${{ secrets.SAML_PRIVATE_KEY }}
JWT_PUBLIC_KEY: ${{ secrets.JWT_PUBLIC_KEY }}
JWT_PRIVATE_KEY: ${{ secrets.JWT_PRIVATE_KEY }}
CSB_REBATE_YEAR: 2024
CSB_2022_FRF_OPEN: true
CSB_2022_PRF_OPEN: true
CSB_2022_CRF_OPEN: true
CSB_2023_FRF_OPEN: true
CSB_2023_PRF_OPEN: true
CSB_2023_CRF_OPEN: true
CSB_2024_FRF_OPEN: true
CSB_2024_PRF_OPEN: true
CSB_2024_CRF_OPEN: true
FORMIO_2022_FRF_PATH: ${{ secrets.FORMIO_2022_FRF_PATH }}
FORMIO_2022_PRF_PATH: ${{ secrets.FORMIO_2022_PRF_PATH }}
FORMIO_2022_CRF_PATH: ${{ secrets.FORMIO_2022_CRF_PATH }}
FORMIO_2023_FRF_PATH: ${{ secrets.FORMIO_2023_FRF_PATH }}
FORMIO_2023_PRF_PATH: ${{ secrets.FORMIO_2023_PRF_PATH }}
FORMIO_2023_CRF_PATH: ${{ secrets.FORMIO_2023_CRF_PATH }}
FORMIO_2023_CHANGE_PATH: ${{ secrets.FORMIO_2023_CHANGE_PATH }}
FORMIO_2024_FRF_PATH: ${{ secrets.FORMIO_2024_FRF_PATH }}
FORMIO_2024_PRF_PATH: ${{ secrets.FORMIO_2024_PRF_PATH }}
FORMIO_2024_CRF_PATH: ${{ secrets.FORMIO_2024_CRF_PATH }}
FORMIO_2024_CHANGE_PATH: ${{ secrets.FORMIO_2024_CHANGE_PATH }}
FORMIO_BASE_URL: ${{ secrets.FORMIO_BASE_URL }}
FORMIO_PROJECT_NAME: ${{ secrets.FORMIO_PROJECT_NAME }}
FORMIO_API_KEY: ${{ secrets.FORMIO_API_KEY }}
FORMIO_PKG_AUTH_TOKEN: ${{ secrets.FORMIO_PKG_AUTH_TOKEN }}
BAP_CLIENT_ID: ${{ secrets.BAP_CLIENT_ID }}
BAP_CLIENT_SECRET: ${{ secrets.BAP_CLIENT_SECRET }}
BAP_URL: ${{ secrets.BAP_URL }}
BAP_USER: ${{ secrets.BAP_USER }}
BAP_PASSWORD: ${{ secrets.BAP_PASSWORD }}
AWS_ACCESS_KEY_ID: ${{ secrets.S3_PUBLIC_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_PUBLIC_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.S3_PUBLIC_REGION }}
S3_PUBLIC_BUCKET: ${{ secrets.S3_PUBLIC_BUCKET }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
# Set up node and npm
- uses: actions/setup-node@master
# Run front-end processes (install, lint, test, bundle)
- name: Cache node modules
uses: actions/cache@v4
with:
path: ~/client/.npm
key: v1-npm-client-deps-${{ hashFiles('**/client/package-lock.json') }}
restore-keys: v1-npm-client-deps-
- name: Add Formio private package repo auth token
run: echo "//pkg.form.io/:_authToken=${FORMIO_PKG_AUTH_TOKEN}" > .npmrc
working-directory: app/client
- name: Install client app dependencies
run: npm install
working-directory: app/client
- name: Build client app and move files to server app
run: |
VITE_SERVER_BASE_PATH="$SERVER_BASE_PATH" \
VITE_CLOUD_SPACE="$CLOUD_SPACE" \
VITE_FORMIO_BASE_URL="$FORMIO_BASE_URL" \
VITE_FORMIO_PROJECT_NAME="$FORMIO_PROJECT_NAME" \
npm run build
rm ../server/app/public/index.html
cd build
mv * ../../server/app/public
working-directory: app/client
# Run CloudFoundry/Cloud.gov deployment
- name: Set up Cloud Foundry CLI
run: |
curl -v -L -o cf-cli_amd64.deb 'https://cli.run.pivotal.io/stable?release=debian64&version=v7&source=github'
sudo dpkg -i cf-cli_amd64.deb
cf -v
cf api https://api.fr.cloud.gov
cf auth "$CF_USER_DEV" "$CF_PASSWORD_DEV"
cf target -o "$CF_ORG" -s "$CF_SPACE"
- name: Set application level variables
run: |
cf set-env $APP_NAME "CLOUD_SPACE" "$CLOUD_SPACE" > /dev/null
cf set-env $APP_NAME "SERVER_URL" "$SERVER_URL" > /dev/null
cf set-env $APP_NAME "SERVER_BASE_PATH" "$SERVER_BASE_PATH" > /dev/null
cf set-env $APP_NAME "SAML_LOGIN_URL" "$SAML_LOGIN_URL" > /dev/null
cf set-env $APP_NAME "SAML_LOGOUT_URL" "$SAML_LOGOUT_URL" > /dev/null
cf set-env $APP_NAME "SAML_ENTITY_ID" "$SAML_ENTITY_ID" > /dev/null
cf set-env $APP_NAME "SAML_IDP_CERT" "$SAML_IDP_CERT" > /dev/null
cf set-env $APP_NAME "SAML_PUBLIC_KEY" "$SAML_PUBLIC_KEY" > /dev/null
# cf set-env $APP_NAME "SAML_PRIVATE_KEY" "$SAML_PRIVATE_KEY" > /dev/null
cf set-env $APP_NAME "JWT_PUBLIC_KEY" "$JWT_PUBLIC_KEY" > /dev/null
cf set-env $APP_NAME "JWT_PRIVATE_KEY" "$JWT_PRIVATE_KEY" > /dev/null
cf set-env $APP_NAME "CSB_REBATE_YEAR" "$CSB_REBATE_YEAR" > /dev/null
cf set-env $APP_NAME "CSB_2022_FRF_OPEN" "$CSB_2022_FRF_OPEN" > /dev/null
cf set-env $APP_NAME "CSB_2022_PRF_OPEN" "$CSB_2022_PRF_OPEN" > /dev/null
cf set-env $APP_NAME "CSB_2022_CRF_OPEN" "$CSB_2022_CRF_OPEN" > /dev/null
cf set-env $APP_NAME "CSB_2023_FRF_OPEN" "$CSB_2023_FRF_OPEN" > /dev/null
cf set-env $APP_NAME "CSB_2023_PRF_OPEN" "$CSB_2023_PRF_OPEN" > /dev/null
cf set-env $APP_NAME "CSB_2023_CRF_OPEN" "$CSB_2023_CRF_OPEN" > /dev/null
cf set-env $APP_NAME "CSB_2024_FRF_OPEN" "$CSB_2024_FRF_OPEN" > /dev/null
cf set-env $APP_NAME "CSB_2024_PRF_OPEN" "$CSB_2024_PRF_OPEN" > /dev/null
cf set-env $APP_NAME "CSB_2024_CRF_OPEN" "$CSB_2024_CRF_OPEN" > /dev/null
cf set-env $APP_NAME "FORMIO_2022_FRF_PATH" "$FORMIO_2022_FRF_PATH" > /dev/null
cf set-env $APP_NAME "FORMIO_2022_PRF_PATH" "$FORMIO_2022_PRF_PATH" > /dev/null
cf set-env $APP_NAME "FORMIO_2022_CRF_PATH" "$FORMIO_2022_CRF_PATH" > /dev/null
cf set-env $APP_NAME "FORMIO_2023_FRF_PATH" "$FORMIO_2023_FRF_PATH" > /dev/null
cf set-env $APP_NAME "FORMIO_2023_PRF_PATH" "$FORMIO_2023_PRF_PATH" > /dev/null
cf set-env $APP_NAME "FORMIO_2023_CRF_PATH" "$FORMIO_2023_CRF_PATH" > /dev/null
cf set-env $APP_NAME "FORMIO_2023_CHANGE_PATH" "$FORMIO_2023_CHANGE_PATH" > /dev/null
cf set-env $APP_NAME "FORMIO_2024_FRF_PATH" "$FORMIO_2024_FRF_PATH" > /dev/null
cf set-env $APP_NAME "FORMIO_2024_PRF_PATH" "$FORMIO_2024_PRF_PATH" > /dev/null
cf set-env $APP_NAME "FORMIO_2024_CRF_PATH" "$FORMIO_2024_CRF_PATH" > /dev/null
cf set-env $APP_NAME "FORMIO_2024_CHANGE_PATH" "$FORMIO_2024_CHANGE_PATH" > /dev/null
cf set-env $APP_NAME "FORMIO_BASE_URL" "$FORMIO_BASE_URL" > /dev/null
cf set-env $APP_NAME "FORMIO_PROJECT_NAME" "$FORMIO_PROJECT_NAME" > /dev/null
cf set-env $APP_NAME "FORMIO_API_KEY" "$FORMIO_API_KEY" > /dev/null
cf set-env $APP_NAME "BAP_CLIENT_ID" "$BAP_CLIENT_ID" > /dev/null
cf set-env $APP_NAME "BAP_CLIENT_SECRET" "$BAP_CLIENT_SECRET" > /dev/null
cf set-env $APP_NAME "BAP_URL" "$BAP_URL" > /dev/null
cf set-env $APP_NAME "BAP_USER" "$BAP_USER" > /dev/null
cf set-env $APP_NAME "BAP_PASSWORD" "$BAP_PASSWORD" > /dev/null
cf set-env $APP_NAME "S3_PUBLIC_BUCKET" "$S3_PUBLIC_BUCKET" > /dev/null
cf set-env $APP_NAME "S3_PUBLIC_REGION" "$AWS_DEFAULT_REGION" > /dev/null
# Sync static content to public S3 bucket
- name: Sync static content to S3
run: aws s3 sync . s3://$S3_PUBLIC_BUCKET/content
working-directory: app/server/app/content
# Set CORS configuration for public S3 bucket
- name: Set S3 CORS configuration
run: aws s3api put-bucket-cors --bucket $S3_PUBLIC_BUCKET --cors-configuration file://s3CORS.json
working-directory: app/server/app/config
# Now that client is built and included in server app, only push server app to Cloud.gov
- name: Deploy application to Cloud.gov
run: cf push $APP_NAME --strategy rolling -f ../manifest-dev.yml -p . -t 180
working-directory: app/server