From 63deb035331adc6e394cdd6d87c7ab0a1e0e157e Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 22 Apr 2022 11:12:09 -0700 Subject: [PATCH 01/13] Add python release action --- .github/workflows/python-package.yml | 33 +++++++++++++++++++++------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e05c05930..2b31ccf75 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -1,4 +1,4 @@ -name: Python package +name: CI on: push: @@ -8,29 +8,46 @@ on: jobs: lint: + name: Lint runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - - name: Set up Python 2 + - name: Set up Python 3 uses: actions/setup-python@v2 with: - python-version: "2.7" + python-version: "3.10" - name: lint run: make lint + - name: fmtcheck + run: make fmtcheck - fmt: + build: + name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Set up Python 3 uses: actions/setup-python@v2 with: python-version: "3.10" - - name: fmtcheck - run: make fmtcheck + - name: Install tools + run: python -m pip install wheel setuptools twine cmarkgfm - build: + - name: Build package + run: python setyp.py clean --all sdist bdist_wheel --universal + + - name: Check package + run: python -m twine --check + + - name: 'Upload Artifact' + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist/ + + test: + name: Test runs-on: ubuntu-latest strategy: matrix: From 27e941f3b9b91cb5a57881e3346ddadf48ee4095 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 22 Apr 2022 11:13:36 -0700 Subject: [PATCH 02/13] typo --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 2b31ccf75..f8ec9b7d3 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -35,7 +35,7 @@ jobs: run: python -m pip install wheel setuptools twine cmarkgfm - name: Build package - run: python setyp.py clean --all sdist bdist_wheel --universal + run: python setup.py clean --all sdist bdist_wheel --universal - name: Check package run: python -m twine --check From 1ea06130aa2356cee7549d26fd237957b6f4514d Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 22 Apr 2022 11:17:56 -0700 Subject: [PATCH 03/13] more --- .github/workflows/python-package.yml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index f8ec9b7d3..350e29caf 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -1,6 +1,7 @@ name: CI on: + workflow_dispatch: {} push: branches: [master] pull_request: @@ -31,8 +32,9 @@ jobs: uses: actions/setup-python@v2 with: python-version: "3.10" + - name: Install tools - run: python -m pip install wheel setuptools twine cmarkgfm + run: make venv - name: Build package run: python setup.py clean --all sdist bdist_wheel --universal @@ -96,3 +98,24 @@ jobs: - name: Test with pytest run: make test-gh-actions + + publish: + name: Publish + #if: (((github.event_name == 'push') || (github.event_name == 'workflow_dispatch')) && (github.ref == 'refs/branches/master' || startsWith(github.ref, 'refs/tags/v')) && endsWith(github.actor, '-stripe')) + needs: [build, test, lint] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Download all workflow run artifacts + uses: actions/download-artifact@v2 + with: + name: dist + path: dist + - name: Set up Python 3 + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install tools + run: make venv + - name: Publish packages to PyPy + run: python -m twine upload sign dist/* From 6a30bda6882fdbd012d25f719a58388fe8978c45 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 22 Apr 2022 11:21:58 -0700 Subject: [PATCH 04/13] more tools --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 606020223..f0a5abd4a 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ venv: $(VENV_NAME)/bin/activate $(VENV_NAME)/bin/activate: setup.py $(PIP) install --upgrade pip virtualenv @test -d $(VENV_NAME) || $(PYTHON) -m virtualenv --clear $(VENV_NAME) - ${VENV_NAME}/bin/python -m pip install -U pip tox + ${VENV_NAME}/bin/python -m pip install -U pip tox wheel setuptools twine cmarkgfm ${VENV_NAME}/bin/python -m pip install -e . @touch $(VENV_NAME)/bin/activate From fd1890e00df451f029b7a3d23d20282564130734 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 22 Apr 2022 11:31:58 -0700 Subject: [PATCH 05/13] help --- Makefile | 2 +- setup.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f0a5abd4a..ab8a5a110 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ venv: $(VENV_NAME)/bin/activate $(VENV_NAME)/bin/activate: setup.py $(PIP) install --upgrade pip virtualenv @test -d $(VENV_NAME) || $(PYTHON) -m virtualenv --clear $(VENV_NAME) - ${VENV_NAME}/bin/python -m pip install -U pip tox wheel setuptools twine cmarkgfm + ${VENV_NAME}/bin/python -m pip install -U pip tox twine ${VENV_NAME}/bin/python -m pip install -e . @touch $(VENV_NAME)/bin/activate diff --git a/setup.py b/setup.py index fa00b819c..f08ddbf3b 100644 --- a/setup.py +++ b/setup.py @@ -60,4 +60,5 @@ "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules", ], + setup_requires=['wheel'] ) From b1b11347f255f6749b10f3feba271bce72704ab1 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 22 Apr 2022 11:40:14 -0700 Subject: [PATCH 06/13] wip --- .github/workflows/python-package.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 350e29caf..62dd32c8b 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -36,11 +36,12 @@ jobs: - name: Install tools run: make venv - - name: Build package - run: python setup.py clean --all sdist bdist_wheel --universal - - - name: Check package - run: python -m twine --check + - name: Build and check package + run: + set -x + source venv/bin/activate + python setup.py clean --all sdist bdist_wheel --universal + python -m twine --check - name: 'Upload Artifact' uses: actions/upload-artifact@v2 From 6bebd86b8aade9f782505f1f4fd86f3272bc01b4 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 22 Apr 2022 11:41:37 -0700 Subject: [PATCH 07/13] wip --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 62dd32c8b..27ea944e3 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -37,7 +37,7 @@ jobs: run: make venv - name: Build and check package - run: + run: | set -x source venv/bin/activate python setup.py clean --all sdist bdist_wheel --universal From 1b3af39521c173612f8a5097e0c2963ffd3e45bb Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 22 Apr 2022 11:42:51 -0700 Subject: [PATCH 08/13] wip --- .github/workflows/python-package.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 27ea944e3..a9ea82070 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -41,7 +41,7 @@ jobs: set -x source venv/bin/activate python setup.py clean --all sdist bdist_wheel --universal - python -m twine --check + python -m twine check dist/* - name: 'Upload Artifact' uses: actions/upload-artifact@v2 @@ -119,4 +119,7 @@ jobs: - name: Install tools run: make venv - name: Publish packages to PyPy - run: python -m twine upload sign dist/* + run: | + set -x + source venv/bin/activate + python -m twine upload --sign dist/* From 20bc568e2d1b90971ca65424c82d78682366242a Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 22 Apr 2022 12:14:07 -0700 Subject: [PATCH 09/13] fmt --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f08ddbf3b..2f07e5741 100644 --- a/setup.py +++ b/setup.py @@ -60,5 +60,5 @@ "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules", ], - setup_requires=['wheel'] + setup_requires=["wheel"], ) From 504d3efa23a17ccaf1a01f211080d052bc2deea1 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 22 Apr 2022 13:18:47 -0700 Subject: [PATCH 10/13] keys --- .github/workflows/python-package.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a9ea82070..3e5e6560b 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -116,10 +116,23 @@ jobs: uses: actions/setup-python@v2 with: python-version: "3.10" + + - name: Configure GPG Key + run: | + echo -n "$GPG_SIGNING_PUBKEY$GPG_SIGNING_PRIVKEY" | gpg --import --pinentry-mode loopback --batch --passphrase '${GPG_SIGNING_KEY_PASSWORD}' + env: + GPG_SIGNING_PUBKEY: ${{ secrets.GPG_SIGNING_PUBKEY }} + GPG_SIGNING_PRIVKEY: ${{ secrets.GPG_SIGNING_PRIVKEY }} + GPG_SIGNING_PASSPHRASE: ${{ secrets.GPG_SIGNING_PASSPHRASE }} - name: Install tools run: make venv - name: Publish packages to PyPy run: | set -x source venv/bin/activate - python -m twine upload --sign dist/* + python -m twine upload --identity $GPG_SIGNING_KEYID --sign dist/* + env: + GPG_SIGNING_KEYID: ${{ secrets.GPG_SIGNING_KEYID }} + TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} + From ca646f3b30cdda5888a747e8aacecb7e9beb99bd Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 22 Apr 2022 13:45:04 -0700 Subject: [PATCH 11/13] yolo --- .github/workflows/python-package.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 3e5e6560b..c1031cc21 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -102,7 +102,7 @@ jobs: publish: name: Publish - #if: (((github.event_name == 'push') || (github.event_name == 'workflow_dispatch')) && (github.ref == 'refs/branches/master' || startsWith(github.ref, 'refs/tags/v')) && endsWith(github.actor, '-stripe')) + if: (((github.event_name == 'push') || (github.event_name == 'workflow_dispatch')) && (github.ref == 'refs/branches/master' || startsWith(github.ref, 'refs/tags/v')) && endsWith(github.actor, '-stripe')) needs: [build, test, lint] runs-on: ubuntu-latest steps: @@ -119,6 +119,7 @@ jobs: - name: Configure GPG Key run: | + set -x echo -n "$GPG_SIGNING_PUBKEY$GPG_SIGNING_PRIVKEY" | gpg --import --pinentry-mode loopback --batch --passphrase '${GPG_SIGNING_KEY_PASSWORD}' env: GPG_SIGNING_PUBKEY: ${{ secrets.GPG_SIGNING_PUBKEY }} From 202c4cccd00863930079bbb1de87316589c1d6bf Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 22 Apr 2022 14:36:20 -0700 Subject: [PATCH 12/13] don --- .github/workflows/python-package.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index c1031cc21..ecfa0a299 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -102,7 +102,7 @@ jobs: publish: name: Publish - if: (((github.event_name == 'push') || (github.event_name == 'workflow_dispatch')) && (github.ref == 'refs/branches/master' || startsWith(github.ref, 'refs/tags/v')) && endsWith(github.actor, '-stripe')) + if: (((github.event_name == 'workflow_dispatch')) && (github.ref == 'refs/branches/master' || startsWith(github.ref, 'refs/tags/v')) && endsWith(github.actor, '-stripe')) needs: [build, test, lint] runs-on: ubuntu-latest steps: @@ -136,4 +136,3 @@ jobs: GPG_SIGNING_KEYID: ${{ secrets.GPG_SIGNING_KEYID }} TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} - From a48fcd60e44995fed0f018752dbf2fb9d468a262 Mon Sep 17 00:00:00 2001 From: pakrym-stripe <99349468+pakrym-stripe@users.noreply.github.com> Date: Wed, 27 Apr 2022 10:03:26 -0700 Subject: [PATCH 13/13] Update python-package.yml --- .github/workflows/python-package.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index ecfa0a299..d90989f7d 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -4,6 +4,8 @@ on: workflow_dispatch: {} push: branches: [master] + tags: + - v[0-9]+.[0-9]+.[0-9]+* pull_request: branches: [master]