Skip to content

Merge pull request #104 from aboutcircles/20241118-docs-update-beta #32

Merge pull request #104 from aboutcircles/20241118-docs-update-beta

Merge pull request #104 from aboutcircles/20241118-docs-update-beta #32

Workflow file for this run

name: Deploy MkDocs to GitHub Pages
on:
push:
branches:
- beta
- candidate/stable
- testdocs
jobs:
deploy:
permissions:
contents: write # This allows writing to the repository contents
pages: write # This allows deploying to GitHub Pages
id-token: write # This is required for requesting the JWT
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.9
- name: Install dependencies
shell: bash -l {0}
run: |
cd docs/
conda install -c conda-forge --file requirements.txt
- name: Build site
shell: bash -l {0}
run: |
cd docs/
mkdocs build
- name: Create Redirect Index
run: |
echo '<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url=beta/" />
</head>
<body>
<p>Redirecting to the latest beta documentation...</p>
</body>
</html>' > ./docs/site/index.html
- name: Determine Deployment Directory
id: branch
run: |
if [[ "${GITHUB_REF_NAME}" == "beta" ]]; then
echo "DEPLOY_DIR=beta" >> $GITHUB_ENV
elif [[ "${GITHUB_REF_NAME}" == "candidate/stable" ]]; then
echo "DEPLOY_DIR=candidate" >> $GITHUB_ENV
elif [[ "${GITHUB_REF_NAME}" == "testdoc" ]]; then
echo "DEPLOY_DIR=test" >> $GITHUB_ENV
else
echo "Unknown branch: ${GITHUB_REF_NAME}" && exit 1
fi
- name: Prepare Deployment Directory
run: |
mkdir -p ./gh-pages/${{ env.DEPLOY_DIR }}
cp -R ./docs/site/* ./gh-pages/${{ env.DEPLOY_DIR }}
if [[ "${GITHUB_REF_NAME}" == "beta" ]]; then
echo '<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url=beta/" />
</head>
<body>
<p>Redirecting to the latest beta documentation...</p>
</body>
</html>' > ./gh-pages/index.html
fi
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gh-pages