diff --git a/.github/workflows/python-package.yml b/.github/workflows/publish-docs.yml similarity index 71% rename from .github/workflows/python-package.yml rename to .github/workflows/publish-docs.yml index fd501df..778d218 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/publish-docs.yml @@ -1,13 +1,8 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Python package +name: Build and publish documentation on: push: - branches: [ master ] - pull_request: - branches: [ master ] + tags: [ "*" ] permissions: contents: write @@ -15,7 +10,6 @@ permissions: jobs: build: - runs-on: ubuntu-latest strategy: matrix: @@ -23,17 +17,21 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements/dev.txt + - name: Build documentation run: | make docs + - name: github pages deploy uses: peaceiris/actions-gh-pages@v3.8.0 with: diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml new file mode 100644 index 0000000..bc6333c --- /dev/null +++ b/.github/workflows/publish-package.yml @@ -0,0 +1,48 @@ +name: Release package on PyPI + +on: + push: + tags: [ "*" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build-n-publish: + name: Build package and publish to TestPyPI and PyPI + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + name: Use Python 3.9 + with: + python-version: 3.9 + + - name: Install pypa/build + run: >- + python -m + pip install + build + --user + + - name: Build a binary wheel and a source tarball + run: >- + python -m + build + --sdist + --wheel + --outdir dist/ + + - name: Publish package to Test PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + + - name: Publish package + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index ed93a00..5d979a8 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -1,7 +1,7 @@ name: Run Tox tests -#on: -# - push -# - pull_request +on: + - push + - pull_request jobs: build: