Skip to content

Commit

Permalink
feat(github-actions): enable automatic PyPi release on publish
Browse files Browse the repository at this point in the history
This commit enables automatic PyPi release for the 'pyvespa' library when a new release is published on GitHub. Previously, the release workflow was disabled, but this change now triggers the release process when a new release is published.

The key changes are:
- Modify the release trigger to listen for 'published' events instead of 'workflow_dispatch'
- Add an environment variable 'RELEASE_REF' to ensure the version is available, even if the 'GITHUB_REF' variable is not set correctly
- Update the version extraction logic to use the 'RELEASE_REF' variable instead of 'GITHUB_REF'
  • Loading branch information
esolitos authored and gitbutler-client committed Aug 29, 2024
1 parent 1ca3a30 commit 30d282a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/pyvespa.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: pyvespa - Release and upload PyPI

on:
workflow_dispatch:
# release: Disable auto-release until actions are approved
# types: [published]
release:
types: [published]

jobs:
update_version:
runs-on: ubuntu-latest
env:
# Workaround to ensure that the version is available
RELEASE_REF: ${{ github.ref || format('{0}{1}', 'refs/tags/', github.event.release.tag_name) }}
steps:
- uses: actions/checkout@v4

Expand All @@ -22,9 +24,8 @@ jobs:
- name: Set version from ref tag that triggered the workflow (strip prefix 'v' from tag)
id: set_version
run: |
echo "GITHUB_REF=$GITHUB_REF"
# strip prefix 'v' from version variable
version=${GITHUB_REF#refs/tags/v}
version=${RELEASE_REF#refs/tags/v}
echo "version=$version" >> $GITHUB_OUTPUT
- name: Update version
Expand Down

0 comments on commit 30d282a

Please sign in to comment.