-
Notifications
You must be signed in to change notification settings - Fork 189
103 lines (101 loc) · 3.31 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
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
on:
workflow_call:
inputs:
API_APP_NAME:
required: true
type: string
API_FQDN:
required: true
type: string
API_PORT:
required: true
type: string
APP_NAME:
required: true
type: string
APP_URL:
required: true
type: string
CF_ORGANIZATION_NAME:
required: true
type: string
CF_SPACE_NAME:
required: true
type: string
NEW_RELIC_APP_NAME:
type: string
S3_BUCKET_URL:
required: true
type: string
S3_SERVICE_NAME:
required: true
type: string
secrets:
API_DATA_GOV_SECRET:
required: true
CF_USERNAME:
required: true
CF_PASSWORD:
required: true
NEW_RELIC_LICENSE_KEY:
env:
API_APP_NAME: ${{ inputs.API_APP_NAME }}
API_FQDN: ${{ inputs.API_FQDN }}
API_DATA_GOV_SECRET: ${{ secrets.API_DATA_GOV_SECRET }}
API_PORT: ${{ inputs.API_PORT }}
APP_NAME: ${{ inputs.APP_NAME }}
APP_URL: ${{ inputs.APP_URL }}
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 }}
S3_BUCKET_URL: ${{ inputs.S3_BUCKET_URL }}
S3_SERVICE_NAME: ${{ inputs.S3_SERVICE_NAME }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Code Checkout
uses: actions/checkout@v4
- name: Install ruby and gem dependencies
uses: ruby/setup-ruby@360dc864d5da99d54fcb8e9148c14a84b90d3e88
with:
bundler-cache: true
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: 'npm'
- name: Install node dependencies
run: npm ci --timing
- name: Copy uswds assets
run: npm run copy-assets
- name: Replace application URLs for the environment in jekyll config file before building the site
run: |
sed -i "s@url: https://analytics\.usa\.gov@url: ${APP_URL}@g" _config.yml
cat _config.yml
- name: Bundle javascript for production
run: npm run build-prod
- name: Build jekyll site
run: bundle exec jekyll build
- 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: 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
cf push -f "./manifest.yml"
# Add network policy to connect to internal API instance
cf add-network-policy $APP_NAME $API_APP_NAME -s $CF_SPACE_NAME -o $CF_ORGANIZATION_NAME --protocol tcp --port $API_PORT
cf logout