From 9bc14a02c1e6d21aa5f4cf1757154c22b5644857 Mon Sep 17 00:00:00 2001 From: Vilmos Nebehaj Date: Sun, 22 Jan 2023 11:39:49 -0800 Subject: [PATCH 1/5] Automate releases --- .github/workflows/build.yaml | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index bedecd5..c3b8396 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,6 +3,8 @@ on: push: branches: - main + tags: + - "v*" pull_request: jobs: build-and-test: @@ -23,10 +25,38 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Build package - run: python setup.py build - - name: Install package - run: python setup.py install + run: | + python -m pip install --upgrade build twine + python -m build + twine check --strict dist/* - name: Install coveralls run: sudo pip install coveralls - name: Run tests run: sudo PATH=$PATH coverage run setup.py test + + release: + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + needs: + - build-and-test (3.7) + - build-and-test (3.8) + - build-and-test (3.9) + - build-and-test (3.10) + - build-and-test (3.11) + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.x" + - name: Build package + run: | + python -m pip install --upgrade build twine + python -m build + twine check --strict dist/* + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} From 5ea087f886bd74e85664d97fc4b4b79d833dc840 Mon Sep 17 00:00:00 2001 From: Vilmos Nebehaj Date: Sun, 22 Jan 2023 11:40:01 -0800 Subject: [PATCH 2/5] Add missing fields to setup.py --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index efefa07..c3e4a46 100644 --- a/setup.py +++ b/setup.py @@ -15,6 +15,8 @@ name=__pkgname__, version=__version__, description="Python bindings for iptables", + long_description="Python bindings for classic iptables", + long_description_content_type="text/x-rst", author="Vilmos Nebehaj", author_email="v.nebehaj@gmail.com", url="https://github.com/ldx/python-iptables", From d6f0faf52f2267510996db9575106a83ac34c287 Mon Sep 17 00:00:00 2001 From: Vilmos Nebehaj Date: Sun, 22 Jan 2023 11:42:07 -0800 Subject: [PATCH 3/5] Fix dependency --- .github/workflows/build.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c3b8396..b530f88 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -38,11 +38,7 @@ jobs: runs-on: ubuntu-latest if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') needs: - - build-and-test (3.7) - - build-and-test (3.8) - - build-and-test (3.9) - - build-and-test (3.10) - - build-and-test (3.11) + - build-and-test steps: - name: Check out code uses: actions/checkout@v2 From 158a82a31b95d6421c12e4ae9328febd8ed7ffb9 Mon Sep 17 00:00:00 2001 From: Vilmos Nebehaj Date: Sun, 22 Jan 2023 11:48:15 -0800 Subject: [PATCH 4/5] Upload release to GitHub --- .github/workflows/build.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b530f88..2efe8e8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -56,3 +56,28 @@ jobs: with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} + - name: Create GitHub release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: false + prerelease: false + - name: Set asset name + run: | + export PKG=$(ls dist/ | grep tar) + set -- $PKG + echo "name=$1" >> $GITHUB_ENV + - name: Upload release asset to GitHub + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/${{ env.name }} + asset_name: ${{ env.name }} + asset_content_type: application/zip From bb2b43b77016bb09bf1f11524a0779bdbdbe5a8e Mon Sep 17 00:00:00 2001 From: Vilmos Nebehaj Date: Sun, 22 Jan 2023 11:53:12 -0800 Subject: [PATCH 5/5] Fix indentation --- .github/workflows/build.yaml | 50 ++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2efe8e8..2003385 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -56,28 +56,28 @@ jobs: with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} - - name: Create GitHub release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: false - prerelease: false - - name: Set asset name - run: | - export PKG=$(ls dist/ | grep tar) - set -- $PKG - echo "name=$1" >> $GITHUB_ENV - - name: Upload release asset to GitHub - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: dist/${{ env.name }} - asset_name: ${{ env.name }} - asset_content_type: application/zip + - name: Create GitHub release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: false + prerelease: false + - name: Set asset name + run: | + export PKG=$(ls dist/ | grep tar) + set -- $PKG + echo "name=$1" >> $GITHUB_ENV + - name: Upload release asset to GitHub + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/${{ env.name }} + asset_name: ${{ env.name }} + asset_content_type: application/zip