Skip to content

Commit

Permalink
Directly deploy (no force push into sep. branch)
Browse files Browse the repository at this point in the history
Ceyron committed Jul 22, 2024
1 parent 0bdbffa commit a3f21b3
Showing 1 changed file with 43 additions and 19 deletions.
62 changes: 43 additions & 19 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,58 @@
name: Build Docs

on:
push:
branches:
- main
permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
build:
strategy:
matrix:
python-version: [ 3.11 ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .
python -m pip install -r docs/requirements.txt
- name: Build docs
run: mkdocs build

- uses: actions/cache@v4
- name: Upload docs
uses: actions/upload-pages-artifact@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
path: site

# Deploy job
deploy:
# Add a dependency to the build job
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action

0 comments on commit a3f21b3

Please sign in to comment.