Skip to content

Commit

Permalink
Merge pull request #11 from sangvikh/dev
Browse files Browse the repository at this point in the history
v2.1.2

Adds check for version bump
  • Loading branch information
sangvikh authored Dec 13, 2024
2 parents fae564b + c22cff0 commit f67f4d4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .github/workflows/check-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Check Version

on:
pull_request:
types: [opened, synchronize]

jobs:
check-version:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all tags

- name: Get latest tag
id: get_latest_tag
run: |
if git describe --tags `git rev-list --tags --max-count=1` > /dev/null 2>&1; then
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
else
echo "No tags found."
echo "latest_tag=" >> $GITHUB_ENV
fi
- name: Read version from manifest.json
id: read_version
run: |
version=$(jq -r '.version' custom_components/hass_pontos/manifest.json)
echo "version=$version" >> $GITHUB_ENV
- name: Compare versions
run: |
latest_tag=${{ env.latest_tag }}
version=${{ env.version }}
if [ -z "$latest_tag" ]; then
echo "No tags found, skipping version check."
else
latest_tag_numeric=$(echo $latest_tag | sed 's/v//; s/[^0-9.]//g')
version_numeric=$(echo $version | sed 's/v//; s/[^0-9.]//g')
if [ "$(printf '%s\n' "$latest_tag_numeric" "$version_numeric" | sort -V | head -n1)" = "$latest_tag_numeric" ] && [ "$latest_tag_numeric" != "$version_numeric" ]; then
echo "Version in manifest.json ($version) is greater than the latest tag ($latest_tag)."
else
echo "Version in manifest.json ($version) is not greater than the latest tag ($latest_tag)."
exit 1
fi
fi
2 changes: 1 addition & 1 deletion custom_components/hass_pontos/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/sangvikh/hass-pontos/issues",
"requirements": [],
"version": "2.1.0"
"version": "2.1.2"
}

0 comments on commit f67f4d4

Please sign in to comment.