Skip to content
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:
- '**.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/loop-hivemq.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/core --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