Skip to content

Commit

Permalink
fix publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
miaucl committed Sep 3, 2024
1 parent c7f6d2f commit 36ba03a
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,22 @@ jobs:
TAG_VERSION=${GITHUB_REF#refs/tags/}
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV
- name: Extract version from file
id: extract_file_version
- name: Check tag in package
run: |
VERSION=$(grep '__VERSION__' ./docker2mqtt/__init__.py | sed -E 's/__VERSION__ = "(.*)"/\1/')
echo "FILE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Extract version from setup config
id: extract_config_version
run: |
VERSION=$(grep 'version' ./setup.cfg | sed -E 's/version = (.*)[[:space:]]*$/\1/')
echo "CONFIG_VERSION=$VERSION" >> $GITHUB_ENV
if ! grep -q "__VERSION__ = \"$TAG_VERSION\"" ./docker2mqtt/__init__.py; then
echo "Error: Tag version $TAG_VERSION not found in the package."
exit 1
else
echo "Success: Tag version $TAG_VERSION found in package."
fi
- name: Compare versions
- name: Check tag in setup.cfg
run: |
if [ "$TAG_VERSION" != "$FILE_VERSION" ]; then
echo "Tag version ($TAG_VERSION) does not match file version ($FILE_VERSION)."
exit 1
elif [ "$TAG_VERSION" != "$CONFIG_VERSION" ]; then
echo "Tag version ($TAG_VERSION) does not match config version ($CONFIG_VERSION)."
if ! grep -q "version = $TAG_VERSION" setup.cfg; then
echo "Error: Tag version $TAG_VERSION not found in the setup.cfg."
exit 1
else
echo "Tag version ($TAG_VERSION) matches file version ($FILE_VERSION)."
echo "Success: Tag version $TAG_VERSION found in setup.cfg."
fi
- name: Check changelog entry
Expand Down

0 comments on commit 36ba03a

Please sign in to comment.