Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f247c78
Update Build and deploy docs CI to be able to publish docs for PR, ta…
PierreQuinton Apr 1, 2025
63d00b4
Make stable replicate the last published tag with format "vX.Y.Z"
PierreQuinton Apr 2, 2025
b313a03
Merge branch 'main' into doc-version-build-deploy
ValerianRey Apr 3, 2025
8a4b101
Use python 3.13 instead of 3.12
ValerianRey Apr 4, 2025
506f310
Change github_repository to be TorchJD/documentation instead of the d…
ValerianRey Apr 4, 2025
8ee2e40
Rename github_repository to external_repository
ValerianRey Apr 4, 2025
7b8b273
Change github_token to actions_deploy_key
ValerianRey Apr 4, 2025
824d933
Change actions_deploy_key to secrets.DOCUMENTATION_DEPLOY_KEY
ValerianRey Apr 4, 2025
308306e
Rename actions_deploy_key to deploy_key
ValerianRey Apr 4, 2025
4be26ad
Remove .github.io from repo name
ValerianRey Apr 4, 2025
ff43932
Rename some steps for clarity
ValerianRey Apr 4, 2025
e723b8f
Add link to documentation in summary
ValerianRey Apr 4, 2025
7ae4b95
Fix link
ValerianRey Apr 4, 2025
af1b2b1
Add step to create check run with doc link
ValerianRey Apr 4, 2025
a22b96a
Revert "Add step to create check run with doc link"
ValerianRey Apr 4, 2025
68448a2
Merge branch 'main' into doc-version-build-deploy
ValerianRey Apr 4, 2025
3363dd8
Change the repository and branch that cleanup-pr-docs.yml writes to
ValerianRey Apr 4, 2025
3095e69
Remove gh-pages folder from the path to which cleanup-pr-docs.yml writes
ValerianRey Apr 4, 2025
a9db3a0
Add workflow_dispatch trigger to cleanup-pr-docs.yml
ValerianRey Apr 4, 2025
ddc23d6
Remove workflow_dispatch trigger from cleanup-pr-docs.yml
ValerianRey Apr 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/build-deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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:
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
32 changes: 32 additions & 0 deletions .github/workflows/cleanup-pr-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Cleanup PR Documentation

on:
pull_request:
types: [closed]

jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
repository: TorchJD/documentation
ref: main
ssh-key: ${{ secrets.DOCUMENTATION_DEPLOY_KEY }}

- name: Remove PR documentation for closed PR
run: |
PR_NUMBER="${{ github.event.number }}"
echo "Removing documentation for PR #${PR_NUMBER}"
rm -rf pr/${PR_NUMBER}

- name: Commit and push cleanup
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git add .
git commit -m "Cleanup documentation for closed PR #${{ github.event.number }}" || echo "No changes to commit"
git push origin HEAD:main