diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 0000000..e639f70 --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -0,0 +1,49 @@ +name: Build Docs + +on: + push: + branches: [ main, dev ] + tags: [ v* ] + +jobs: + deploy-docs: + runs-on: ubuntu-latest + permissions: + contents: write + strategy: + fail-fast: false + + steps: + - name: Checkout DesignerDNA Project + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version-file: .python-version-default + + - name: Install dependencies + run: | + python -m pip install -U pip + pip install wheel setuptools + pip install ".[doc]" + + - name: Build documentation + run: | + sphinx-multiversion docs/source _build + + - name: Add Redirect Page + # NOTE: when only one version is built, it is not within a separate directory + if: ${{ hashFiles('_build/index.html') == '' }} + run: | + cp docs/source/_templates/redirect.html _build/index.html + + - name: Deploy to Github Pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./_build + publish_branch: gh-pages + force_orphan: true diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..f174420 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,37 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +name: Upload Python Package + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + deploy: + runs-on: ubuntu-latest + if: github.event_name == 'release' + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install -U pip --disable-pip-version-check + python -m pip install setuptools wheel build + + - name: Build package + run: python -m build + + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }}