From b2ad506f516283b1a9dd55947ac3895175a95849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20L=C3=BCpges?= Date: Tue, 1 Dec 2026 16:30:42 +0100 Subject: [PATCH] Deploy docs using environment --- .github/workflows/ci.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f252646..a73925b8 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" (GitLab CI still deploys the docs while both pipelines run). + # 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 }}