forked from pytorch/functorch
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (75 loc) · 2.38 KB
/
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
77
78
79
80
81
82
name: Build and Deploy Docs
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main
jobs:
build-docs:
runs-on: ubuntu-18.04
steps:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
architecture: x64
- name: Checkout functorch
uses: actions/checkout@v2
- name: Install PyTorch Nightly
run: |
python3 -mpip install --pre torch>=1.12.0.dev -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
- name: Install functorch
run: |
python3 setup.py install
- name: Install docs requirements
run: |
cd docs
python3 -mpip install -r requirements.txt
- name: Build docs
run: |
cd docs
make html
- name: Upload docs as GHA artifact
uses: actions/upload-artifact@v2
with:
name: built-docs
path: docs/build/html
deploy-docs:
needs: [build-docs]
runs-on: ubuntu-latest
if: (github.ref == 'refs/heads/main' && github.event_name == 'push')
steps:
- uses: actions/checkout@v2
with:
ref: gh-pages
fetch-depth: 3
- name: Download docs artifact
uses: actions/download-artifact@v2
with:
name: built-docs
path: /tmp/docs
- name: Copy built docs to nightly
id: copy-docs
run: |
cp -R /tmp/docs/* nightly/
git log -3
# Set commit name and hash as variables: commit_name, commit_hash
echo "::set-output name=commit_name::$(git log -1 --format='%s')"
echo "::set-output name=commit_hash::$(git log -1 --format='%h')"
- name: Git reset to commit/amend
if: ${{ steps.copy-docs.outputs.commit_name == 'auto-generated commit' }}
run: |
# if commit_name is "auto-generated commit"
# then go back in commit history to commit to the same commit
git reset --soft ${{ steps.copy-docs.outputs.commit_hash }}~1
git log -3
- name: Commit and push to gh-pages
uses: github-actions-x/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
push-branch: 'gh-pages'
commit-message: 'auto-generated commit'
force-push: 'true'
name: gha
email: [email protected]