This repository was archived by the owner on Feb 4, 2025. It is now read-only.
Push to gh-pages on merge (#34) #2
This file contains hidden or 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: Releases | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
release: | |
types: | |
- created | |
jobs: | |
publish: | |
name: Publish to TestPyPI | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.8" | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v3 | |
with: | |
poetry-version: "1.3.2" | |
- name: Install tox | |
run: pip install tox | |
# Setting the proper version | |
- name: Get previous Tag | |
if: github.ref == 'refs/heads/master' | |
id: previous_tag | |
uses: WyriHaximus/github-action-get-previous-tag@v1 | |
with: | |
fallback: 0.1.0 | |
- name: Set Build version | |
if: github.ref == 'refs/heads/master' | |
run: poetry version "${{ steps.previous_tag.outputs.tag }}.dev${{ github.run_number }}" | |
- name: Set Release version | |
if: github.event_name == 'release' && github.event.action == 'created' | |
run: poetry version ${{ github.ref_name }} | |
# Build and deploy docs | |
- name: Build docs | |
if: github.ref == 'refs/heads/master' | |
run: | | |
tox -e docs | |
- name: Deploy docs | |
if: github.ref == 'refs/heads/master' | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/_build/html/ | |
# Build package | |
- name: Build poetry package | |
run: poetry build | |
# Publish to TestPyPI | |
- name: Publish distribution 📦 to PyPI | |
if: github.event_name == 'release' && github.event.action == 'created' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ |