Skip to content

Trigger documentation publish #4

Trigger documentation publish

Trigger documentation publish #4

Workflow file for this run

name: Trigger documentation publish
on:
push:
tags: ['v*']
workflow_run:
workflows: [Build]
types: [completed]
branches: [main]
jobs:
dispatch:
runs-on: ubuntu-latest
if: >-
github.event_name == 'push'
|| github.event.workflow_run.conclusion == 'success'
steps:
- name: Fire repository_dispatch to site repo
env:
GH_TOKEN: ${{ secrets.DOCS_DISPATCH_TOKEN }}
run: |
if [ "${{ github.event_name }}" = "push" ]; then
REF="${{ github.ref_name }}"
SHA="${{ github.sha }}"
else
REF="${{ github.event.workflow_run.head_branch }}"
SHA="${{ github.event.workflow_run.head_sha }}"
fi
if [[ "$REF" == v* ]]; then
VERSION_LABEL="${REF#v}"
else
VERSION_LABEL="dev"
fi
jq -n \
--arg ref "$SHA" \
--arg ver "$VERSION_LABEL" \
'{event_type: "publish-docs", client_payload: {source_ref: $ref, version: $ver, update_latest: true}}' \
| gh api repos/hardwood-hq/hardwood-hq.github.io/dispatches --input -