-
Notifications
You must be signed in to change notification settings - Fork 15
68 lines (59 loc) · 2.28 KB
/
build-deploy-docs.yml
File metadata and controls
68 lines (59 loc) · 2.28 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
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
name: Build and Deploy Documentation
on:
push:
branches: [ main ]
tags:
- 'v[0-9]*.[0-9]*.[0-9]*'
pull_request:
types: [opened, synchronize, reopened]
jobs:
Build_and_deploy_doc:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: '3.13'
- name: Install dependencies (default & doc)
run: pdm install --group doc --frozen-lockfile
- name: Build Documentation
working-directory: docs
run: pdm run make dirhtml
- name: Determine deployment folder
id: deploy_folder
run: |
echo "Determining deployment folder..."
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "Deploying to target pr/${{ github.event.number }}"
echo "DEPLOY_DIR=pr/${{ github.event.number }}" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo "Deploying to target ${{ github.ref_name }}"
echo "DEPLOY_DIR=${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
echo "Deploying to target main"
echo "DEPLOY_DIR=main" >> $GITHUB_OUTPUT
fi
- name: Deploy to DEPLOY_DIR of TorchJD/documentation
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.DOCUMENTATION_DEPLOY_KEY }}
publish_dir: docs/build/dirhtml
destination_dir: ${{ steps.deploy_folder.outputs.DEPLOY_DIR }}
external_repository: TorchJD/documentation
publish_branch: main
- name: Deploy to stable of TorchJD/documentation
if: startsWith(github.ref, 'refs/tags/')
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.DOCUMENTATION_DEPLOY_KEY }}
publish_dir: docs/build/dirhtml
destination_dir: stable
external_repository: TorchJD/documentation
publish_branch: main
- name: Add documentation link to summary
run: |
echo "### 📄 [View Deployed Documentation](https://torchjd.github.io/documentation/${{ steps.deploy_folder.outputs.DEPLOY_DIR }})" >> $GITHUB_STEP_SUMMARY