Skip to content

Merge pull request #74 from dynatrace-extensions/fix-pg #68

Merge pull request #74 from dynatrace-extensions/fix-pg

Merge pull request #74 from dynatrace-extensions/fix-pg #68

Workflow file for this run

name: Update Docs
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install hatch
run: |
pip install hatch
- name: Install dependencies
run: |
hatch env create
- name: Build the docs
run: |
hatch run docs:build
- name: Cache built docs as artifact
uses: actions/upload-artifact@v2
with:
name: rendered-docs
path: |
docs/_build/**
upload-docs:
runs-on: ubuntu-latest
needs:
- build-docs
steps:
- name: Download built docs as cached artifact
uses: actions/download-artifact@v2
with:
name: rendered-docs
- name: Change Git username for gh-pages branch
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Initialize gh-pages branch
run: |
git init
git remote add deploy "https://token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
git checkout -b gh-pages
- name: Add README disclaimer
run: |
echo '# GitHub Pages for `dt-extensions-sdk`' > README.md
echo "" >> README.md
echo "The contents of this branch are built using GitHub Actions workflow and Sphinx." >> README.md
echo "" >> README.md
echo "*commit ${GITHUB_SHA:0:6}*" >> README.md
- name: Add .nojekyll file to prevent the contents from being built by GitHub pages second time
run: |
touch .nojekyll
- name: Push everything to gh-pages branch on GitHub
run: |
git add .
git commit -m "📝 Rebuilt docs: commit ${GITHUB_SHA:0:6}"
git push deploy gh-pages --force