Skip to content

Commit

Permalink
Merge pull request #28 from felipeangelimvieira/fix/release_process
Browse files Browse the repository at this point in the history
[FIX] Fix release process version verification
  • Loading branch information
felipeangelimvieira authored May 10, 2024
2 parents ae58c0a + b5a19b6 commit 3b93d19
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,33 @@ jobs:
id: get_tag_version
run: echo "::set-output name=tag_version::${GITHUB_REF#refs/tags/v}"

- name: Extract tag version without pre-release identifiers
id: get_tag_version_clean
run: |
# This extracts the version number and removes any pre-release identifiers like '-rc1'
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
CLEAN_TAG_VERSION="${TAG_VERSION%%-*}"
echo "::set-output name=clean_tag_version::$CLEAN_TAG_VERSION"
- name: Get current package version
id: get_package_version
run: echo "::set-output name=package_version::$(poetry version --short)"

- name: Verify versions match
run: |
if [ "${{ steps.get_tag_version.outputs.tag_version }}" != "${{ steps.get_package_version.outputs.package_version }}" ]; then
if [ "${{ steps.get_tag_version.outputs.clean_tag_version }}" != "${{ steps.get_package_version.outputs.package_version }}" ]; then
echo "Error: Tag version does not match the pyproject.toml version"
exit 1
fi
- name: Set version to match the release tag
run: |
echo "Setting package version to ${{ steps.get_tag_version.outputs.clean_tag_version }}"
poetry version "${{ steps.get_tag_version.outputs.clean_tag_version }}""
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry build
poetry publish
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-alpha') || contains(github.ref, '-beta') }}

0 comments on commit 3b93d19

Please sign in to comment.