From d2d8cfa527d527bfe2aa5f102dae2169cc36d6a7 Mon Sep 17 00:00:00 2001 From: Nuno Sousa Date: Thu, 3 Aug 2023 10:34:58 +0100 Subject: [PATCH] Add release action --- .bumpversion.cfg | 5 ++++ .github/workflows/release.yml | 45 +++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 .bumpversion.cfg create mode 100644 .github/workflows/release.yml diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 00000000..6ad311a9 --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,5 @@ +[bumpversion] +current_version = 0.0.2 +parse = (?P\d+)\.(?P\d+)\.(?P\d+) +serialize = + {major}.{minor}.{patch} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..871263d5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: Release + +on: + workflow_dispatch: + inputs: + version: + type: choice + description: The new version to build and publish + required: true + default: 'patch' + options: + - major + - minor + - patch + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: '3.x' + cache: 'pip' + cache-dependency-path: setup.py + + - name: Install dependencies + run: | + python -m pip install bump2version twine wheel + + - name: Bump version + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + bumpversion --commit ${{ github.event.inputs.version }} customerio/analytics/version.py + + - name: Publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/*