From 735657b6d62b7d381d5b0b1e9e325134793786e3 Mon Sep 17 00:00:00 2001 From: Jirka Date: Sun, 11 Jul 2021 17:35:39 +0200 Subject: [PATCH] CI: release + setup tags --- .github/workflows/release-pypi.yml | 85 ++++++++++++++++++++++++++++++ setup.py | 3 +- 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release-pypi.yml diff --git a/.github/workflows/release-pypi.yml b/.github/workflows/release-pypi.yml new file mode 100644 index 00000000..64a1c3a8 --- /dev/null +++ b/.github/workflows/release-pypi.yml @@ -0,0 +1,85 @@ +name: PyPI Release + +# https://help.github.com/en/actions/reference/events-that-trigger-workflows +on: # Trigger the workflow on push or pull request, but only for the master branch + push: + branches: [master, "release/*"] + release: + types: [published] + + +jobs: + # based on https://github.com/pypa/gh-action-pypi-publish + build-package: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Install dependencies + run: >- + python -m pip install --user --upgrade setuptools wheel + + - name: Build packages + run: | + python setup.py sdist # bdist_wheel + ls -lh dist/ + + - uses: actions/upload-artifact@v2 + with: + name: pypi-packages-${{ github.sha }} + path: dist + + upload-package: + runs-on: ubuntu-20.04 + needs: build-package + steps: + - uses: actions/checkout@v2 + - uses: actions/download-artifact@v2 + with: + name: pypi-packages-${{ github.sha }} + path: dist + - run: ls -lh dist/ + + - name: Upload to release + if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' + uses: AButler/upload-release-assets@v2.0 + with: + files: 'dist/*' + repo-token: ${{ secrets.GITHUB_TOKEN }} + + publish-package: + runs-on: ubuntu-20.04 + needs: build-package + steps: + - uses: actions/checkout@v2 + - uses: actions/download-artifact@v2 + with: + name: pypi-packages-${{ github.sha }} + path: dist + - run: ls -lh dist/ + + - name: Delay releasing + if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' + uses: juliangruber/sleep-action@v1 + with: + time: 5m + + # We do this, since failures on test.pypi aren't that bad + - name: Publish to Test PyPI + if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' + uses: pypa/gh-action-pypi-publish@v1.4.1 + with: + user: __token__ + password: ${{ secrets.test_pypi_password }} + repository_url: https://test.pypi.org/legacy/ + verbose: true + +# - name: Publish distribution 📦 to PyPI +# if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' +# uses: pypa/gh-action-pypi-publish@v1.4.1 +# with: +# user: __token__ +# password: ${{ secrets.pypi_password }} diff --git a/setup.py b/setup.py index 4c75cc7c..ae19cbe0 100644 --- a/setup.py +++ b/setup.py @@ -104,12 +104,13 @@ def _parse_requirements(file_path): "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", - "Topic :: Scientific/Engineering :: Image Segmentation", 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', ], )