Skip to content

Commit 848efd5

Browse files
authored
Action to auto-trigger docs build in readthedocs -> Main (#148)
1 parent 64272bd commit 848efd5

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "Publish Docs"
2+
3+
on:
4+
# Auto-trigger this workflow on tag creation
5+
push:
6+
tags:
7+
- 'v*.*.*'
8+
# Auto-trigger this workflow on merge to main changes in docs/** folder
9+
pull_request_target:
10+
types:
11+
- closed
12+
branches:
13+
- main
14+
paths:
15+
- 'docs/**'
16+
17+
jobs:
18+
build-n-publish:
19+
name: Build and publish Docs 📖 to Readthedocs
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: When PR ✅ merged - Trigger Readthedocs build
24+
if: github.event.pull_request.merged == true
25+
env:
26+
RTDS_ADS_PROJECT: https://readthedocs.org/api/v3/projects/accelerated-data-science
27+
RTDS_ADS_TOKEN: ${{ secrets.RTDS_ADS_TOKEN }}
28+
run: |
29+
curl \
30+
-X POST \
31+
-H "Authorization: Token $RTDS_ADS_TOKEN" $RTDS_ADS_PROJECT/versions/latest/builds/
32+
- name: When tag 🏷️ pushed - Trigger Readthedocs build
33+
if: github.event_name != 'pull_request'
34+
env:
35+
RTDS_ADS_PROJECT: https://readthedocs.org/api/v3/projects/accelerated-data-science
36+
RTDS_ADS_TOKEN: ${{ secrets.RTDS_ADS_TOKEN }}
37+
run: |
38+
curl \
39+
-X POST \
40+
-H "Authorization: Token $RTDS_ADS_TOKEN" $RTDS_ADS_PROJECT/versions/${{ github.ref_name }}/builds/

0 commit comments

Comments
 (0)