Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
66 lines (58 loc) · 1.95 KB
/
Copy pathaction.yml
File metadata and controls
66 lines (58 loc) · 1.95 KB
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
name: "Deploy"
description: "Run deploy script and contract tests"
inputs:
github_ssh_key:
description: "Github SSH Key to read shared terraform modules"
required: true
terraform_root:
description: "Terraform root configuration name"
required: true
terraform_workspace:
description: "Terraform workspace to select"
required: true
node_auth_token:
description: "Node auth token environment variable"
required: false
run_contract_tests:
description: "Indicates whether the run contract tests step should be run"
required: false
default: 'true'
runs:
using: "composite"
steps:
- name: Configure Github Credentials
shell: bash
run: |
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo '${{ inputs.github_ssh_key }}' > ~/.ssh/id_rsa
ssh-keyscan github.com > ~/.ssh/known_hosts
chmod 600 ~/.ssh/id_rsa ~/.ssh/known_hosts
- name: Npm CI
shell: bash
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ inputs.node_auth_token }}
- name: Terraform Setup
shell: bash
working-directory: terraform/${{ inputs.terraform_root }}
run: |
echo terraform init
terraform init
echo select terraform workspace ${{ inputs.terraform_workspace }}
node ../../node_modules/.bin/core-build select-workspace -w ${{ inputs.terraform_workspace }}
- name: NPM Run Deploy
shell: bash
working-directory: terraform/${{ inputs.terraform_root }}
run: |
echo save terraform outputs to file
terraform output -json > outputs.json
echo pipe outputs.json into npm run deploy
cat outputs.json | npm run deploy --if-present
- name: NPM Run Contract Tests
if: ${{inputs.run_contract_tests == 'true' }}
shell: bash
working-directory: terraform/${{ inputs.terraform_root }}
run: |
echo running contract-tests command if present
npm run contract-tests --if-present