-
Notifications
You must be signed in to change notification settings - Fork 2
76 lines (62 loc) · 1.97 KB
/
gh-pages-docs.yml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Update Docs
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install hatch
run: |
pip install hatch
- name: Install dependencies
run: |
hatch env create
- name: Build the docs
run: |
hatch run docs:build
- name: Cache built docs as artifact
uses: actions/upload-artifact@v2
with:
name: rendered-docs
path: |
docs/_build/**
upload-docs:
runs-on: ubuntu-latest
needs:
- build-docs
steps:
- name: Download built docs as cached artifact
uses: actions/download-artifact@v2
with:
name: rendered-docs
- name: Change Git username for gh-pages branch
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Initialize gh-pages branch
run: |
git init
git remote add deploy "https://token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
git checkout -b gh-pages
- name: Add README disclaimer
run: |
echo '# GitHub Pages for `dt-extensions-sdk`' > README.md
echo "" >> README.md
echo "The contents of this branch are built using GitHub Actions workflow and Sphinx." >> README.md
echo "" >> README.md
echo "*commit ${GITHUB_SHA:0:6}*" >> README.md
- name: Add .nojekyll file to prevent the contents from being built by GitHub pages second time
run: |
touch .nojekyll
- name: Push everything to gh-pages branch on GitHub
run: |
git add .
git commit -m "📝 Rebuilt docs: commit ${GITHUB_SHA:0:6}"
git push deploy gh-pages --force