Update Schemas #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Schemas | |
on: | |
# Trigger the workflow every Monday at 08:00 Belgrade time (adjusted for UTC) | |
schedule: | |
- cron: '0 7 * * 1' | |
workflow_dispatch: | |
inputs: | |
release_version: | |
type: string | |
description: Which release version to index (type v1.0.6 for example) | |
default: "latest" | |
select_index: | |
type: choice | |
description: Index as test or live (Live indexes only to live, Test indexes to both) | |
options: | |
- Test | |
- Live | |
run_test: | |
type: boolean | |
description: If checked generates test files only - schemas_test.json/docs_test.7z | |
default: true | |
jobs: | |
update-schemas: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r scripts/requirements/shared.txt | |
sudo apt-get install p7zip-full | |
- name: Determine if schedule or manual trigger | |
id: determine-trigger | |
run: | | |
if [[ "${{ github.event_name }}" == "schedule" ]]; then | |
echo "Triggered by schedule. Setting run_test to False." | |
echo "run_test=False" >> $GITHUB_OUTPUT | |
else | |
echo "Triggered manually. Using provided run_test input." | |
echo "run_test=${{ github.event.inputs.run_test }}" >> $GITHUB_OUTPUT | |
fi | |
- name: Upload and re-index | |
env: | |
ES_HOST: ${{ secrets.ES_HOST }} | |
ES_USER: ${{ secrets.ES_USER }} | |
ES_PASSWORD: ${{ secrets.ES_PASSWORD }} | |
ES_INDEX_TEST: ${{ secrets.ES_INDEX_TEST }} | |
ES_INDEX_LIVE: ${{ secrets.ES_INDEX_LIVE }} | |
run: | | |
INDEX_TEST="True" | |
if [[ ${{ steps.determine-trigger.outputs.run_test }} == "False" ]]; then | |
INDEX_TEST="False" | |
fi | |
echo "Index test set to $INDEX_TEST" | |
if [[ ${{ github.event.inputs.select_index }} == "Live" ]]; then | |
echo "Uploading and indexing to Live." | |
python -u scripts/update_schemas.py ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.event.inputs.release_version }} ${{ secrets.ES_INDEX_LIVE }} "$INDEX_TEST" | |
else | |
echo "Uploading and indexing to Test and Live." | |
python -u scripts/update_schemas.py ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.event.inputs.release_version }} ${{ secrets.ES_INDEX_TEST }} "$INDEX_TEST" | |
fi |