Skip to content

Update schema for ref v1.x #1221

Update schema for ref v1.x

Update schema for ref v1.x #1221

Workflow file for this run

name: Schemas
run-name: Update schema for ref ${{ github.event.client_payload.ref || inputs.ref || 'v1.x' }}
on:
workflow_dispatch: # Activate this workflow manually
inputs:
ref:
description: Tag or branch name of Haystack version
required: true
type: string
default: v1.x
# Activate this workflow with an API call
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#repository_dispatch
repository_dispatch:
types: [generate-pipeline-schemas]
env:
HAYSTACK_REF: ${{ github.event.client_payload.ref || inputs.ref || 'v1.x' }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
jobs:
run:
name: Update schema for ref ${{ github.event.client_payload.ref || inputs.ref || 'v1.x' }}
runs-on: ubuntu-latest
steps:
- name: Validate release
id: validate
# Silently discard docker releases for test purposes to not publish schema files for them, while avoiding a red CI.
continue-on-error: true
run: |
echo "${HAYSTACK_REF}" | egrep '^v1.x|v[0-9]+\.[0-9]+\.[0-9]+$'
- if: steps.validate.outcome == 'success'
name: Checkout
uses: actions/checkout@v3
- if: steps.validate.outcome == 'success'
name: Update schema
run: |
if [ "${HAYSTACK_REF}" == "v1.x" ]; then
export HAYSTACK_REF="main"
fi
docker run -t -v "${PWD}:/haystack-json-schema" "docker.io/deepset/haystack:base-cpu-${HAYSTACK_REF}" python /haystack-json-schema/.github/utils/generate_json_schema.py
if [ "${HAYSTACK_REF}" == "main" ]; then
export HAYSTACK_REF="v1.x"
fi
- if: steps.validate.outcome == 'success'
name: Commit files
run: |
git status
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
if [ "${HAYSTACK_REF}" != "main" ]; then
git restore --staged --worktree json-schema/haystack-pipeline-main.schema.json
fi
git commit -m "Update Schema for ${HAYSTACK_REF}" -a || echo "No changes to commit"
git push
- uses: act10ns/slack@v1
with:
status: ${{ job.status }}
channel: '#haystack'
if: steps.validate.outcome == 'success' && failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/v1.x'