Skip to content

Commit a0966cb

Browse files
Merge pull request #42 from ioet/Inject-Secrets-CI
Inject Secrets
2 parents 0ac80c1 + dd0f31e commit a0966cb

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.github/workflows/CD-time-tracker-ui.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,26 @@ jobs:
2424
with:
2525
node-version: '12.x'
2626

27+
- name: Inject Secrets
28+
shell: python
29+
env:
30+
SCOPES: ${{ secrets.scopes }}
31+
CLIENT_ID: ${{ secrets.client_id }}
32+
AUTHORITY: ${{ secrets.authority }}
33+
BASE_PATH: "src/environments/"
34+
run: |
35+
import os
36+
import json
37+
data = {}
38+
base_path = os.environ.get('BASE_PATH', 'src/environments/')
39+
with open(base_path + "keys.example.json", "r+") as jsonFileRead:
40+
data = json.load(jsonFileRead)
41+
data["scopes"] = str(os.environ['SCOPES']).split(",")
42+
data["client_id"] = os.environ['CLIENT_ID']
43+
data["authority"] = os.environ['AUTHORITY']
44+
with open(base_path + ".keys.json", "w+") as jsonFileWrite:
45+
json.dump(data, jsonFileWrite)
46+
2747
- name: 'run: npm install and build'
2848
run: |
2949
npm install

.github/workflows/CI-time-tracker-ui.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,25 @@ jobs:
3939
- name: Install dependencies
4040
run: npm install
4141

42+
- name: Inject Secrets
43+
shell: python
44+
env:
45+
SCOPES: ${{ secrets.scopes }}
46+
CLIENT_ID: ${{ secrets.client_id }}
47+
AUTHORITY: ${{ secrets.authority }}
48+
BASE_PATH: "src/environments/"
49+
run: |
50+
import os
51+
import json
52+
data = {}
53+
base_path = os.environ.get('BASE_PATH', 'src/environments/')
54+
with open(base_path + "keys.example.json", "r+") as jsonFileRead:
55+
data = json.load(jsonFileRead)
56+
data["scopes"] = str(os.environ['SCOPES']).split(",")
57+
data["client_id"] = os.environ['CLIENT_ID']
58+
data["authority"] = os.environ['AUTHORITY']
59+
with open(base_path + ".keys.json", "w+") as jsonFileWrite:
60+
json.dump(data, jsonFileWrite)
61+
4262
- name: Run the test
4363
run: npm run ci-test --if-present

0 commit comments

Comments
 (0)