From 0a1d55b32ad4f697219d87ad1959ccc23af4ec7a Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 13 Apr 2021 12:33:43 +0300 Subject: workflows/test: add job for publishing to PyPI --- .github/workflows/test.yml | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b97eea3..49a1c51 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,12 +6,12 @@ on: workflow_dispatch: jobs: - local: + test_local: runs-on: ubuntu-18.04 strategy: matrix: python-version: [3.6, 3.7, 3.8, 3.9] - name: 'Test locally / ${{ matrix.python-version }}' + name: 'Test: ${{ matrix.python-version }}' steps: - name: Checkout uses: actions/checkout@v2 @@ -26,19 +26,19 @@ jobs: - name: Test run: ./.ci/local/test.sh - docker: + test_docker: runs-on: ubuntu-18.04 - name: Test in Docker + name: 'Test: Docker' steps: - name: Checkout uses: actions/checkout@v2 - name: Test run: ./.ci/docker/test.sh - publish: - needs: [local, docker] + publish_docker: + needs: [test_local, test_docker] runs-on: ubuntu-18.04 - name: Publish + name: 'Publish: Docker Hub' if: github.ref == 'refs/heads/master' steps: - name: Set up QEMU @@ -56,3 +56,30 @@ jobs: platforms: linux/amd64,linux/armhf push: true tags: '${{ secrets.DOCKERHUB_USERNAME }}/cgitize:latest' + + publish_pypi: + needs: [test_local, test_docker] + runs-on: ubuntu-18.04 + name: 'Publish: PyPI' + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.6 + - name: Install tools + run: python3 -m pip install --upgrade build twine + - name: Build package + run: python3 -m build + - name: Upload dist + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist + - name: Publish package + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} -- cgit v1.2.3