diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ece349f5..4882da0a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,9 +77,7 @@ jobs: path: htmlcov/ retention-days: 14 - # Builds the docs (with the coverage report under /coverage) on every run; - # deploys them to https://wbgeo.github.io/ only from main, and only once the repository - # variable DEPLOY_DOCS is "true" (and the secret DOCS_DEPLOY_KEY is set). + # Builds the docs (with the coverage report under /coverage) on every run. docs: needs: test runs-on: ubuntu-latest @@ -109,8 +107,24 @@ jobs: path: public/ retention-days: 14 + # Deploys the docs to https://wbgeo.github.io/. + # Only from the main branch and the main environment, + # and only once the variable DEPLOY_DOCS is "true" (and the secret DOCS_DEPLOY_KEY is set). + # DEPLOY_DOCS and the secret DOCS_DEPLOY_KEY live in that environment. + deploy-docs: + needs: docs + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + environment: main + steps: + - uses: actions/download-artifact@v4 + if: vars.DEPLOY_DOCS == 'true' + with: + name: site + path: public + - name: Deploy to wbgeo.github.io - if: vars.DEPLOY_DOCS == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main' + if: vars.DEPLOY_DOCS == 'true' uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 with: deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }}