diff --git a/.github/workflows/create-release-on-version-bump.yml b/.github/workflows/create-release-on-version-bump.yml new file mode 100644 index 0000000..1851664 --- /dev/null +++ b/.github/workflows/create-release-on-version-bump.yml @@ -0,0 +1,37 @@ +name: Create Release on Version Bump + +on: + push: + branches: + - main + +jobs: + tag-and-release: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Extract version + id: get_version + run: | + version=$(grep -m1 'version = ' pyproject.toml | cut -d'"' -f2) + echo "::set-output name=VERSION::$version" + + - name: Create Tag + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git tag v${{ steps.get_version.outputs.VERSION }} + git push origin v${{ steps.get_version.outputs.VERSION }} + + - name: Create Release + uses: actions/create-release@v1 + with: + tag_name: v${{ steps.get_version.outputs.VERSION }} + release_name: Release ${{ steps.get_version.outputs.VERSION }} + body: | + Release of version ${{ steps.get_version.outputs.VERSION }} + draft: false + prerelease: false + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 33535fd..fe56683 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -9,15 +9,14 @@ name: Upload Python Package on: - push: - branches: [ "main" ] + release: + types: [created] permissions: contents: read jobs: deploy: - runs-on: ubuntu-latest steps: @@ -36,4 +35,5 @@ jobs: uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: user: __token__ - password: ${{ secrets.PYPI}} + password: ${{ secrets.PYPI }} +