From 503c7133b729b9082fe16b423e3dc211072486b7 Mon Sep 17 00:00:00 2001 From: Sina Atalay Date: Fri, 28 Jun 2024 22:42:32 +0300 Subject: [PATCH] workflows: update docs deployment --- .github/workflows/deploy-docs.yaml | 62 +++++++++++++++++++----------- docs/developer_guide/index.md | 4 -- pyproject.toml | 2 - 3 files changed, 40 insertions(+), 28 deletions(-) diff --git a/.github/workflows/deploy-docs.yaml b/.github/workflows/deploy-docs.yaml index e57b5dd..81a33a9 100644 --- a/.github/workflows/deploy-docs.yaml +++ b/.github/workflows/deploy-docs.yaml @@ -1,41 +1,59 @@ -name: Deploy documentation +name: Deploy the documentation -# GitHub events that triggers the workflow: on: + # Runs on pushes targeting the default branch push: branches: ["main"] + # Allows you to run this workflow manually from the Actions tab + 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: - name: Deploy + # Build job + build: + name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python 3.12 uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python-version }} + python-version: 3.12 - name: Install Hatch uses: pypa/hatch@install - - name: Store cache ID - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - - - name: Create a key - uses: actions/cache@v4 - with: - key: mkdocs-material-${{ env.cache_id }} - path: .cache - restore-keys: | - mkdocs-material- - - - name: Deploy documentation + - name: Build the website run: | - hatch run docs:deploy \ No newline at end of file + hatch run docs:build + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: site + + # Deployment job + deploy: + name: Deploy + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/docs/developer_guide/index.md b/docs/developer_guide/index.md index 9bf6922..2ef69fb 100644 --- a/docs/developer_guide/index.md +++ b/docs/developer_guide/index.md @@ -99,10 +99,6 @@ These commands are defined in the [`pyproject.toml`](https://github.com/sinaatal ```bash hatch run docs:build ``` -- Deploy the documentation to GitHub Pages: - ```bash - hatch run docs:deploy - ``` - Update [schema.json](https://github.com/sinaatalay/rendercv/blob/main/schema.json): ```bash hatch run docs:update-schema diff --git a/pyproject.toml b/pyproject.toml index 79a7345..fae4d4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -163,8 +163,6 @@ path = ".venv-docs" build = "mkdocs build --clean --strict" # hatch run docs:build # Start the development server for the documentation with `mkdocs`: serve = "mkdocs serve" # hatch run docs:serve -# Deploy the documentation to docs.rendercv.com with `mkdocs`: -deploy = "mkdocs gh-deploy --force" # hatch run docs:deploy # Update schema.json: update-schema = "python docs/update_schema.py" # hatch run docs:update-schema # Update `examples` folder: