-
Notifications
You must be signed in to change notification settings - Fork 8
81 lines (70 loc) · 2.27 KB
/
build.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
name: OpenData Build
on:
workflow_dispatch:
workflow_call:
inputs:
ods_branch:
description: 'Build package from branch'
required: false
type: string
outputs:
json_filename:
description: "OED JSON specification"
value: ${{ jobs.build.outputs.oed_json_spec }}
excel_filename:
description: "OED EXCEL specification"
value: ${{ jobs.build.outputs.oed_excel_spec }}
jobs:
build:
name: Build OED schema
runs-on: ubuntu-latest
outputs:
oed_json_spec: ${{ steps.build_result.outputs.oed_json_spec }}
oed_excel_spec: ${{ steps.build_result.outputs.oed_excel_spec }}
env:
SPEC_PATH_IN: './OpenExposureData'
JSON_PATH_OUT: './ods_tools/data/OpenExposureData_Spec.json'
EXCEL_PATH_OUT: './ods_tools/data/OpenExposureData_Spec.xlsx'
steps:
- name: Github context
run: echo "$GITHUB_CONTEXT"
shell: bash
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
- name: Clone
uses: actions/checkout@v3
if: inputs.ods_branch == ''
with:
ref: ${{ github.ref }}
- name: Clone (workflow_call)
uses: actions/checkout@v3
if: inputs.ods_branch != ''
with:
repository: OasisLMF/ODS_OpenExposureData
ref: ${{ inputs.ods_branch }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- run: pip install pip-tools pandas pyarrow openpyxl click tox
- name: Create JSON
run: ./utils/gen-json.py --source-csv-dir ${{ env.SPEC_PATH_IN }} --output-path ${{ env.JSON_PATH_OUT }}
- name: Create Excel
run: ./utils/gen-excel.py --source-csv-dir ${{ env.SPEC_PATH_IN }} --output-path ${{ env.EXCEL_PATH_OUT }}
- name: Store JSON
uses: actions/upload-artifact@v4
with:
name: extracted_spec
path: ${{ env.JSON_PATH_OUT }}
retention-days: 14
- name: Store Excel
uses: actions/upload-artifact@v4
with:
name: excel_spec
path: ${{ env.EXCEL_PATH_OUT }}
retention-days: 14
- name: Build output
id: build_result
run: |
echo "oed_json_spec=OpenExposureData_Spec.json" >> $GITHUB_OUTPUT
echo "oed_excel_spec=OpenExposureData_Spec.xlsx" >> $GITHUB_OUTPUT