v2.1.2 #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Version | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
check-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- 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 "::set-output name=latest_tag::$latest_tag" | |
else | |
echo "No tags found." | |
echo "::set-output name=latest_tag::" | |
fi | |
- name: Read version from manifest.json | |
id: read_version | |
run: | | |
version=$(jq -r '.version' custom_components/hass_pontos/manifest.json) | |
echo "::set-output name=version::$version" | |
- name: Compare versions | |
run: | | |
latest_tag=${{ steps.get_latest_tag.outputs.latest_tag }} | |
version=${{ steps.read_version.outputs.version }} | |
if [ -z "$latest_tag" ]; then | |
echo "No tags found, skipping version check." | |
elif [ "$latest_tag" = "$version" ]; then | |
echo "Version in manifest.json ($version) is the same as the latest tag ($latest_tag)." | |
exit 1 | |
else | |
echo "Version in manifest.json ($version) is different from the latest tag ($latest_tag)." | |
fi |