Merge pull request #386 from gro-intelligence/GAIA-29324 #42
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: "Build and Deploy" | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "development" | |
tags: | |
- "v1.**" | |
concurrency: | |
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" | |
cancel-in-progress: true | |
permissions: | |
contents: "read" | |
id-token: "write" | |
pages: "write" | |
jobs: | |
build: | |
runs-on: "ubuntu-20.04" | |
steps: | |
- name: "Checkout repository" | |
uses: "actions/checkout@v3" | |
with: | |
ref: "development" | |
# Required for sphinx-multiversion | |
- run: "git fetch --depth=1 origin '+refs/tags/*:refs/remotes/origin/*'" | |
- name: "Setup Python" | |
uses: "actions/setup-python@v4" | |
with: | |
python-version: "3.6.15" | |
- name: "Install dependencies" | |
run: | | |
pip install poetry==1.2.0a2 poetry-dynamic-versioning==0.17.1 | |
poetry install --with docs | |
- name: "Build docs" | |
run: "poetry run sphinx-multiversion docs docs/_build/html" | |
- name: "Copy the `development` branch docs to the landing page" | |
run: | | |
# With sphinxcontrib-versioning, we would generate a separate directory of docs | |
# for each version tag and branch, but also have the default branch's i.e. `development` | |
# docs at the top level.`sphinx-multiversion` only generates the separate | |
# directories. To avoid breaking links, we copy the the root ref docs (i.e., | |
# the `development` branch docs) to the parent directory containing all docs. | |
cp -R "docs/_build/html/development/." docs/_build/html | |
- name: "Upload artifact" | |
uses: "actions/upload-pages-artifact@v1" | |
with: | |
path: "docs/_build/html" | |
deploy: | |
runs-on: "ubuntu-20.04" | |
environment: | |
name: "github-pages" | |
url: "${{ steps.deployment.outputs.page_url }}" | |
needs: "build" | |
steps: | |
- name: "Checkout repository" | |
uses: "actions/checkout@v3" | |
- name: "Setup Python" | |
uses: "actions/setup-python@v4" | |
with: | |
python-version: "3.6.15" | |
- name: "Install dependencies" | |
run: | | |
pip install poetry==1.2.0a2 poetry-dynamic-versioning==0.17.1 | |
- name: "Deploy to TEST-PyPI" | |
if: "${{ github.ref_type == 'branch' }}" | |
run: >- | |
# Use the test-pypi index for the development branch | |
poetry config repositories.testpypi https://test.pypi.org/legacy/ && | |
poetry publish --build -u __token__ -p ${{secrets.TESTPYPI_TOKEN }} -r testpypi | |
- name: "Deploy to PyPI" | |
if: "${{ github.ref_type == 'tag' }}" | |
run: | | |
poetry publish --build -u __token__ -p ${{ secrets.PYPI_TOKEN }} | |
- name: "Deploy to GitHub Pages" | |
id: "deployment" | |
uses: "actions/deploy-pages@v1" |