Skip to content

Update ca-eccc-msc-surface-weather-observations.yml #43

Update ca-eccc-msc-surface-weather-observations.yml

Update ca-eccc-msc-surface-weather-observations.yml #43

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.11"]
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v5
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@master
with:
ref: gh-pages
- name: check for updates, update gh-pages branch and publish
run: |
git checkout gh-pages
git config --global user.email "tomkralidis@gmail.com"
git config --global user.name "Tom Kralidis"
rm -rf *.json
cp -f /tmp/wcmp2-records/* .
if [[ `git status --porcelain` ]]; then
git add .
git commit -am "update WMCP2 records"
git push
echo "WCMP2_UPDATE_LIST=\"`git diff --name-only HEAD HEAD~1`\"" >> $GITHUB_ENV
else
echo "No changes to push"
fi
shell: bash
- name: checkout main branch again
uses: actions/checkout@master
with:
ref: main
- name: Publish WNMs of WCMP2 records
run: |
for i in ${{ env.WCMP2_UPDATE_LIST }}; do echo "Publishing WCMP2 file $i" && 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