From 0b49b2bc798ee668db9d2d190e51ead953fd296f Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Thu, 14 Mar 2024 14:19:55 -0400 Subject: [PATCH] update target branch for TTL publication --- .github/workflows/README.md | 6 +++--- .github/workflows/generate-and-commit-ttl.yml | 18 +++++++++++------- .../workflows/publish-to-wmo-codes-testing.yml | 6 +++--- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 39152b0..9d7aa00 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -3,9 +3,9 @@ The following GitHub Actions are in place for this repository: - on Pull Request: test the generation of WCMP2 Codelists to TTL files -- on Commit/Push to `main` branch: generate WCMP2 Codelists to TTL files, and push to `publication` branch -- on Commit/Push to `publication` branch: publish the TTL files to the WMO Codes Registry testing environment +- on Commit/Push to `main` branch: generate WCMP2 Codelists to TTL files, and push to `gh-pages` branch +- on Commit/Push to `gh-pages` branch: publish the TTL files to the WMO Codes Registry testing environment -Edit `codelists/*.csv` files -> GitHub Pull Request (test generation) -> Merge Pull Request (generate and commit to `publication` branch) -> Publish to WMO Codes Registry testing environment +Edit `codelists/*.csv` files -> GitHub Pull Request (test generation) -> Merge Pull Request (generate and commit to `gh-pages` branch) -> Publish to WMO Codes Registry testing environment Publication to the WMO Codes Registry operational environment is executed as a manual step. diff --git a/.github/workflows/generate-and-commit-ttl.yml b/.github/workflows/generate-and-commit-ttl.yml index 99c81ab..50b4353 100644 --- a/.github/workflows/generate-and-commit-ttl.yml +++ b/.github/workflows/generate-and-commit-ttl.yml @@ -23,19 +23,23 @@ jobs: - name: Generate TTL files run: | python3 scripts/codelists2ttl.py - - name: checkout publication branch + - name: checkout gh-pages branch uses: actions/checkout@v3 with: - ref: publication - - name: update publication branch and publish + ref: gh-pages + - name: update gh-pages branch and publish run: | mkdir /tmp/wis mv wis/ tmp/ - git checkout publication + git checkout gh-pages git config --global user.email "tomkralidis@gmail.com" git config --global user.name "Tom Kralidis" rm -rf wis/* cp -rpf /tmp/wis/* . - git add . - git commit -am "update WMCP2 Codelists TTL files" - git push + if [[ `git status --porcelain` ]]; then + git add . + git commit -am "update WMCP2 Codelists TTL files" + git push + else + echo "No changes to push" + fi diff --git a/.github/workflows/publish-to-wmo-codes-testing.yml b/.github/workflows/publish-to-wmo-codes-testing.yml index c4aeb0b..9e02d96 100644 --- a/.github/workflows/publish-to-wmo-codes-testing.yml +++ b/.github/workflows/publish-to-wmo-codes-testing.yml @@ -7,7 +7,7 @@ env: on: push: branches: - - publication + - gh-pages paths: - 'wis/**.ttl' @@ -20,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - ref: publication + ref: gh-pages - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: @@ -36,6 +36,6 @@ jobs: run: | python3 -m pip install --upgrade pip pip3 install -r scripts/requirements.txt - - name: update publication branch and publish + - name: update gh-pages branch and publish run: | python3 scripts/upload_changes.py {WMO_CODES_TEST_USER_ID} {WMO_CODES_TEST_API_KEY} test /tmp/wis --status experimental