-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (54 loc) · 1.92 KB
/
publish-metadata.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
name: Publish WCMP2 discovery metadata
env:
WIS2_CENTRE_ID: ca-eccc-msc
PYWIS_PUBSUB_BROKER_URL: ${{ secrets.PYWIS_PUBSUB_BROKER_URL }}
on:
push:
branches:
- main
paths:
- 'metadata/mcf/**.yml'
jobs:
main:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Setup Python ${{ matrix.python-version }}
with:
python-version: ${{ matrix.python-version }}
- name: Install requirements
run: |
python3 -m pip install --upgrade pip
pip3 install https://github.com/geopython/pygeometa/archive/master.zip
pip3 install https://github.com/wmo-im/pywis-pubsub/archive/main.zip
- name: make temporary directory
run: |
mkdir /tmp/wcmp2-records
- name: Generate WCMP2 records from MCFs
run: |
for i in metadata/mcf/*.yml; do pygeometa metadata generate --schema wmo-wcmp2 $i --output /tmp/wcmp2-records/`basename ${i%.yml}.json`; done
- name: checkout gh-pages branch
uses: actions/checkout@v3
with:
ref: gh-pages
- name: update gh-pages branch and publish
run: |
git checkout gh-pages
git config --global user.email "[email protected]"
git config --global user.name "Tom Kralidis"
rm -rf *.json
cp -f /tmp/wcmp2-records/* .
git add .
git commit -am "update WMCP2 records"
git push
- name: checkout main branch again
uses: actions/checkout@v3
with:
ref: main
- name: Publish WNMs of WCMP2 records
run: |
for i in /tmp/wcmp2-records/*.json; do pywis-pubsub publish --topic origin/a/wis2/${WIS2_CENTRE_ID}/metadata --config .github/workflows/pywis-pubsub-config/publish.yml -u https://wmo-cop.github.io/wis2node-metadata-mgmt/`basename $i` -i `cat /proc/sys/kernel/random/uuid` -v DEBUG; done