diff --git a/.github/actions/sphinx/deploy/action.yml b/.github/actions/sphinx/deploy/action.yml index e6118ee0f..d3568bc66 100644 --- a/.github/actions/sphinx/deploy/action.yml +++ b/.github/actions/sphinx/deploy/action.yml @@ -14,8 +14,7 @@ inputs: required: false default: scaleway BUCKET: - required: false - default: prod-probabl-skore + required: true SOURCE: required: true DESTINATION: diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml index cfdd2eb61..9f3a3742a 100644 --- a/.github/workflows/sphinx.yml +++ b/.github/workflows/sphinx.yml @@ -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 @@ -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 @@ -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") @@ -177,10 +199,12 @@ 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: @@ -188,7 +212,7 @@ jobs: 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: