-
Notifications
You must be signed in to change notification settings - Fork 2
40 lines (36 loc) · 1.12 KB
/
Copy pathdocs.yml
File metadata and controls
40 lines (36 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Trigger Docs Build
on:
push:
branches:
- main
paths:
- 'docs/**'
- 'python/**'
- '.readthedocs.yaml'
- '.github/workflows/docs.yml'
workflow_dispatch:
concurrency:
group: docs-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
trigger-rtd:
runs-on: ubuntu-latest
steps:
- name: Trigger Read the Docs Webhook
if: env.RTD_WEBHOOK_URL != ''
env:
RTD_WEBHOOK_URL: ${{ secrets.RTD_WEBHOOK_URL }}
RTD_TOKEN: ${{ secrets.RTD_TOKEN }}
run: |
REF_NAME="${{ github.ref_name }}"
TOKEN_PARAM=()
if [ -n "${RTD_TOKEN}" ]; then
TOKEN_PARAM=(-d "token=${RTD_TOKEN}")
fi
if [ "${{ github.ref_type }}" = "tag" ]; then
echo "Triggering RTD build for tag: ${REF_NAME}"
curl -sSf -X POST "${TOKEN_PARAM[@]}" -d "branches=${REF_NAME}" "${RTD_WEBHOOK_URL}"
else
echo "Triggering RTD build for branch: ${REF_NAME}"
curl -sSf -X POST "${TOKEN_PARAM[@]}" -d "branches=${REF_NAME}" "${RTD_WEBHOOK_URL}"
fi