From fd744ac24c3c10c47b8f9c92ee9c87fc311cb9d5 Mon Sep 17 00:00:00 2001 From: Zach White Date: Sat, 27 Mar 2021 18:38:47 -0700 Subject: [PATCH] Setup an action to publish a release --- .github/workflows/python-publish.yml | 47 ++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/python-publish.yml diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..834db14 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,47 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +name: Upload Python Package + +on: + workflow_dispatch: + inputs: + version_part: + description: 'Which part of the version to increment (patch, minor, major)' + required: true + default: 'patch' + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.7' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel + pip install -r requirements-dev.txt + - name: Bump version + run: | + git config --local user.email "hello@qmk.fm" + git config --local user.name "QMK Bot" + bumpversion ${{ github.event.inputs.version_part }} + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: master + tags: true + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/*