Skip to content

Commit

Permalink
ci: Add workflow to serve documentation preview in PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
thomass-dev committed Dec 27, 2024
1 parent 056ae94 commit 8937e8a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .github/actions/sphinx/deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ inputs:
required: false
default: scaleway
BUCKET:
required: false
default: prod-probabl-skore
required: true
SOURCE:
required: true
DESTINATION:
Expand Down
32 changes: 28 additions & 4 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,30 @@ jobs:
name: sphinx-html-artifact
path: sphinx/build/html/

sphinx-deploy-html:
sphinx-preview:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
needs: sphinx-build
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: sphinx-html-artifact
path: html/
- uses: ./.github/actions/sphinx/deploy
with:
CONFIGURATION: ${{ secrets.RCLONE_CONFIG_DOC_PREVIEW }}
BUCKET: ${{ vars.DOCUMENTATION_PREVIEW_BUCKET }}
SOURCE: html/
DESTINATION: ${{ github.event.number }}/
- run: echo "<${URL}/${PR_NUMBER}>" >> "${GITHUB_STEP_SUMMARY}"
env:
URL: ${{ vars.DOCUMENTATION_PREVIEW_URL }}
PR_NUMBER: ${{ github.event.number }}

sphinx-deploy-html:
if: ${{ (github.event_name == 'release') || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
runs-on: ubuntu-latest
needs: [sphinx-version, sphinx-build]
steps:
- uses: actions/checkout@v4
Expand All @@ -128,12 +149,13 @@ jobs:
- uses: ./.github/actions/sphinx/deploy
with:
CONFIGURATION: ${{ secrets.RCLONE_CONFIG_DOCS }}
BUCKET: ${{ vars.DOCUMENTATION_BUCKET }}
SOURCE: html/
DESTINATION: ${{ needs.sphinx-version.outputs.SPHINX_VERSION }}/

sphinx-deploy-root-files:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
needs: [sphinx-version, sphinx-build, sphinx-deploy-html]
steps:
- uses: actions/checkout@v4
Expand All @@ -144,7 +166,7 @@ jobs:
import operator
import json
url = "https://skore.probabl.ai"
url = os.environ["URL"]
current = os.environ["CURRENT"]
response = requests.get(f"{url}/versions.json")
Expand Down Expand Up @@ -177,18 +199,20 @@ jobs:
"""
)
env:
URL: ${{ vars.DOCUMENTATION_URL }}
CURRENT: ${{ needs.sphinx-version.outputs.SPHINX_VERSION }}
- uses: ./.github/actions/sphinx/deploy
with:
CONFIGURATION: ${{ secrets.RCLONE_CONFIG_DOCS }}
BUCKET: ${{ vars.DOCUMENTATION_BUCKET }}
ACTION: copy
SOURCE: artifacts/
DESTINATION:

sphinx-clean:
runs-on: ubuntu-latest
if: always()
needs: [sphinx-version, sphinx-build, sphinx-deploy-html, sphinx-deploy-root-files]
needs: [sphinx-version, sphinx-build, sphinx-preview, sphinx-deploy-html, sphinx-deploy-root-files]
steps:
- uses: geekyeggo/delete-artifact@v5
with:
Expand Down

0 comments on commit 8937e8a

Please sign in to comment.