diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6738c36..ab551f4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,9 +1,19 @@ name: Python package -on: [push, pull_request] +on: + # Trigger the workflow on push or pull request, but only for the master branch + push: + branches: + - master + pull_request: + branches: + - master + +env: + target_python_version: 3.8 jobs: - build: + test: runs-on: ubuntu-latest strategy: max-parallel: 5 @@ -19,13 +29,28 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox tox-gh-actions wheel + pip install tox tox-gh-actions - name: Test with tox run: tox + + publish: + needs: test + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{env.target_python_version}} + uses: actions/setup-python@v2 + with: + python-version: ${{env.target_python_version}} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install wheel - name: Build distributions run: python setup.py sdist bdist_wheel --universal - name: Upload release to pypi - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@v1.4.1 + uses: pypa/gh-action-pypi-publish@v1.4.2 with: password: ${{ secrets.pypi_password }} diff --git a/HISTORY.rst b/HISTORY.rst index d209c5d..2c7c8b4 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -135,3 +135,7 @@ History ------------------ * Support newer openwrt snapshot versions (#45) * Fix tox in github actions and also test py38 (#46) + +1.1.x (unreleased) +------------------ +* Publish to pypi only once in github actions (#47)