Skip to content

Commit

Permalink
[FIX] Release process - use awk to remove release candidate suffixes,…
Browse files Browse the repository at this point in the history
… and avoid deprecated set-output

Fix/release process
  • Loading branch information
felipeangelimvieira authored May 10, 2024
2 parents 3b93d19 + a2fd8c5 commit 2234888
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,31 @@ jobs:
run: pip install poetry

- name: Extract tag version
id: get_tag_version
run: echo "::set-output name=tag_version::${GITHUB_REF#refs/tags/v}"
run: echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

- 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"
CLEAN_TAG_VERSION=$(echo $TAG_VERSION | awk -F- '{print $1}')
echo $CLEAN_TAG_VERSION
echo "CLEAN_TAG_VERSION=$CLEAN_TAG_VERSION" >> $GITHUB_ENV
- name: Get current package version
id: get_package_version
run: echo "::set-output name=package_version::$(poetry version --short)"
run: |
PACKAGE_VERSION=$(poetry version --short)
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
- name: Verify versions match
run: |
if [ "${{ steps.get_tag_version.outputs.clean_tag_version }}" != "${{ steps.get_package_version.outputs.package_version }}" ]; then
if [ "$CLEAN_TAG_VERSION" != "$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 }}""
echo "Setting package version to $CLEAN_TAG_VERSION"
poetry version "$CLEAN_TAG_VERSION"
- name: Publish to PyPI
env:
Expand Down

0 comments on commit 2234888

Please sign in to comment.