Skip to content

Publish Vocabulary to D-WIS webpage #127

Publish Vocabulary to D-WIS webpage

Publish Vocabulary to D-WIS webpage #127

name: Publish Vocabulary to D-WIS webpage
on:
workflow_dispatch:
inputs:
force_updates:
description: 'Force updates of terms, even without changes to them'
required: true
default: 'false'
force_deletion:
decription: 'Force deletion of existing terms before updates'
required: true
default: 'false'
# push: # push must be changed to trigger after md's have been generated (workflow trigger?)
# paths:
# - 'docs/vocabulary_developement/definitions/**.md'
workflow_run:
workflows: [Generate cleaned vocabulary and packages]
types: [completed]
jobs:
publish_vocabulary:
runs-on: ubuntu-latest
# Run if the previous workflow succeeded, or if manually dispatched
#if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name=='workflow_dispatch'}}
env:
SCRIPT_PATH: "${{ github.workspace }}/docs/vocabulary_development/scripts"
SOURCE_PATH: "${{ github.workspace }}/docs/vocabulary_development/auto-generated/md"
WORDPRESS_USER: "cicd"
WORDPRESS_APPLICATION_PASSWORD: "${{ secrets.WORDPRESS_APPLICATION_PASSWORD }}"
WORDPRESS_URL: "https://d-wis.org/"
WORDPRESS_USE_REST_ROUTE: "true"
FORCE_UPDATE: "false"
FORCE_DELETION: "false"
RUN: "true"
steps:
# Override env variables with content from the Workflow Dispatch dialog
- name: override-dispatch-variables
if: ${{ github.event_name=='workflow_dispatch' }}
run: |
echo "FORCE_UPDATE=${{ github.event.inputs.force_updates }}" >> $GITHUB_ENV
echo "FORCE_DELETION=${{ github.event.inputs.force_deletion }}" >> $GITHUB_ENV
- name: early-abort-on-vocabulary-generation-failure
if: ${{ github.event_name=='workflow_run' && github.event.workflow_run.conclusion == 'failure'}}
run: |
echo "Vocabulary generation workflow failed... Abort this workflow without failure..."
echo "RUN=false" >> $GITHUB_ENV
- uses: actions/checkout@v2
# use the md file in the repo
# - name: 'Download the generated files from artifacts'
# uses: actions/download-artifact@v3
# with:
# name: generated-md-files
# path: "${{ github.workspace }}/docs/vocabulary_development/auto-generated/md"
# - name: Extract Artifact
# run: |
# ls
# ls $SOURCE_PATH
# git status
- name: Run publish script
run: |
cd $SCRIPT_PATH
if [ -z "$WORDPRESS_APPLICATION_PASSWORD" ]
then
echo Application password not set, aborting without failure
exit 0
else
pip install -r requirements.txt
python update_web_vocabulary.py
fi