From 60400e1a7da2f9613af22524378df592081ffdf7 Mon Sep 17 00:00:00 2001 From: Benjamin Bollen Date: Mon, 18 Nov 2024 19:52:46 +0000 Subject: [PATCH] (workflow): pull branches, drop conda for just pip, improve html --- .github/workflows/deploy-mkdocs.yml | 86 ++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 27 deletions(-) diff --git a/.github/workflows/deploy-mkdocs.yml b/.github/workflows/deploy-mkdocs.yml index 3d8c500..a51f357 100644 --- a/.github/workflows/deploy-mkdocs.yml +++ b/.github/workflows/deploy-mkdocs.yml @@ -6,59 +6,91 @@ on: - beta - candidate/stable - testdocs + +permissions: + contents: write + pages: write + id-token: write 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 + - uses: actions/checkout@v4 with: - auto-update-conda: true - python-version: 3.9 - + fetch-depth: 1 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.9' + cache: 'pip' + - name: Install dependencies - shell: bash -l {0} run: | cd docs/ - conda install -c conda-forge --file requirements.txt - - - name: Build Beta Docs + pip install -r requirements.txt + + - name: Build Beta Documentation run: | + git fetch --depth 1 origin beta:beta git checkout beta cd docs/ mkdocs build mkdir -p ../gh-pages/beta - cp -R site/* ../gh-pages/beta - - - name: Build Stable Docs + cp -R site/* ../gh-pages/beta/ + + - name: Build Stable Documentation run: | + git fetch --depth 1 origin candidate/stable:candidate/stable git checkout candidate/stable cd docs/ mkdocs build mkdir -p ../gh-pages/stable - cp -R site/* ../gh-pages/stable - + cp -R site/* ../gh-pages/stable/ + - name: Create Redirect Index run: | - echo ' + cat > ./gh-pages/index.html << 'EOF' + - - - - + + Documentation Redirect + + + + +

Documentation

Redirecting to the latest beta documentation...

- - ' > ./gh-pages/index.html + + + + EOF - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./gh-pages + force_orphan: true \ No newline at end of file