From 58262e4fa3f845de6d7cdd1f9da2ff7ab2239a10 Mon Sep 17 00:00:00 2001 From: "Y.D.X." <73375426+YDX-2147483647@users.noreply.github.com> Date: Thu, 25 Jan 2024 00:16:09 +0800 Subject: [PATCH] ci(deploy): Deploy directly Without needing to set up a publishing source, the `gh-pages` branch. https://github.blog/changelog/2022-07-27-github-pages-custom-github-actions-workflows-beta/ --- .github/workflows/deploy.yml | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f4e59a9..256d31e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,5 +1,8 @@ # https://squidfunk.github.io/mkdocs-material/publishing-your-site/#with-github-actions +# https://www.mkdocs.org/user-guide/deploying-your-docs/#other-providers +# https://github.com/actions/starter-workflows/blob/main/pages/ name: deploy + on: push: branches: @@ -9,13 +12,25 @@ on: - '.github/**' - 'scripts/**' - '.pre-commit-config.yaml' + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: - contents: write + 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: - deploy: + build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # RSS plugin needs all history - uses: actions/setup-python@v4 @@ -28,4 +43,16 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: ts-graphviz/setup-graphviz@v1 - run: just bootstrap - - run: mkdocs gh-deploy --force --no-history + - run: just build + - uses: actions/upload-pages-artifact@v3 + with: + path: site/ + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/deploy-pages@v4 + id: deployment