From fca193b5b249762d1ba3ac2da2aa3671774b3851 Mon Sep 17 00:00:00 2001 From: jango-blockchained Date: Thu, 6 Feb 2025 04:49:42 +0100 Subject: [PATCH] ci: Modernize GitHub Actions workflow for documentation deployment - Refactor deploy-docs.yml to use latest GitHub Pages deployment strategy - Add explicit permissions for GitHub Pages deployment - Separate build and deploy jobs for improved workflow clarity - Use actions/configure-pages and actions/deploy-pages for deployment - Implement concurrency control for deployment runs --- .github/workflows/deploy-docs.yml | 48 ++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 8389661..9663705 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -1,4 +1,5 @@ name: Deploy Documentation + on: push: branches: @@ -7,28 +8,53 @@ on: - 'docs/**' - 'mkdocs.yml' +# 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. +concurrency: + group: "pages" + cancel-in-progress: false + jobs: - deploy: + build: runs-on: ubuntu-latest - permissions: - contents: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 + - uses: actions/setup-python@v5 with: python-version: '3.x' cache: 'pip' + + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r docs/requirements.txt - - name: Configure Git - run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - - name: Build and Deploy - run: | - mkdocs build --strict - mkdocs gh-deploy --force --clean \ No newline at end of file + + - name: Build documentation + run: mkdocs build --strict + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./site + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + needs: build + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file