From d261fb9642afc9092f8309ff9a28207f7c4eaa27 Mon Sep 17 00:00:00 2001 From: Daniel Nicoletti Date: Sun, 7 Jul 2024 21:55:01 -0300 Subject: [PATCH] chore(ci): Use GitHub upload-pages-artifact and deploy-pages actions --- .github/workflows/documentation.yml | 47 +++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 05a83fae..d5010879 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -8,6 +8,21 @@ on: paths: - docs/** - mkdocs.yml + pull_request: + branches: + - main + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false jobs: mkdocs: @@ -22,16 +37,22 @@ jobs: pip install --user mkdocs-material pip install --user mkdocs-build-plantuml-plugin - name: Deploy GitHub Pages - run: | - mkdocs build - git worktree add gh-pages gh-pages - git config user.name "Deploy from CI" - git config user.email "" - cd gh-pages - # Delete the ref to avoid keeping history. - git update-ref -d refs/heads/gh-pages - rm -rf * - mv ../site/* . - git add . - git commit -m "Deploy $GITHUB_SHA to gh-pages" - git push --force + run: mkdocs build + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: site/ + + # Deployment job, what was uploaded to artifact + deploy: + needs: mkdocs + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4