-
Notifications
You must be signed in to change notification settings - Fork 3
77 lines (75 loc) · 2.42 KB
/
deploy.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
on:
workflow_call:
inputs:
APP_NAME:
required: true
type: string
CF_ORGANIZATION_NAME:
required: true
type: string
CF_SPACE_NAME:
required: true
type: string
DB_SERVICE_NAME:
required: true
type: string
NEW_RELIC_APP_NAME:
type: string
secrets:
API_DATA_GOV_SECRET:
required: true
CF_USERNAME:
required: true
CF_PASSWORD:
required: true
NEW_RELIC_LICENSE_KEY:
env:
API_DATA_GOV_SECRET: ${{ secrets.API_DATA_GOV_SECRET }}
APP_NAME: ${{ inputs.APP_NAME }}
DB_SERVICE_NAME: ${{ inputs.DB_SERVICE_NAME }}
CF_USERNAME: ${{ secrets.CF_USERNAME }}
CF_PASSWORD: ${{ secrets.CF_PASSWORD }}
CF_ORGANIZATION_NAME: ${{ inputs.CF_ORGANIZATION_NAME }}
CF_SPACE_NAME: ${{ inputs.CF_SPACE_NAME }}
NEW_RELIC_APP_NAME: ${{ inputs.NEW_RELIC_APP_NAME }}
NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY }}
jobs:
deploy_api:
runs-on: ubuntu-latest
steps:
- name: Code checkout
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: 'npm'
- name: Install node dependencies
# This causes npm install to omit dev dependencies per NPM docs.
env:
NODE_ENV: production
run: npm ci
- name: Install cloud foundry CLI for interacting with cloud.gov
run: |
sudo curl -v -L -o cf8-cli-installer_8.7.4_x86-64.deb 'https://packages.cloudfoundry.org/stable?release=debian64&version=8.7.4'
sudo dpkg -i cf8-cli-installer_8.7.4_x86-64.deb
- name: Run envsubst on manifest.yml to set environment specific values
run: |
mv manifest.yml manifest.yml.src
envsubst < manifest.yml.src > manifest.yml
cat manifest.yml
- name: Replace config.js and knexfile.js with .cloudgov versions of those files
run: |
rm ./src/config.js
mv ./src/config.cloudgov.js ./src/config.js
rm knexfile.js
mv knexfile.cloudgov.js knexfile.js
- name: Login to cloud.gov and deploy
run: |
set -e
# Log into cloud.gov
cf api api.fr.cloud.gov
cf login -u $CF_USERNAME -p $CF_PASSWORD -o $CF_ORGANIZATION_NAME -s $CF_SPACE_NAME
# Deploy app
cf push -f "./manifest.yml"
cf logout