-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
action.yml
40 lines (38 loc) · 1.36 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: 'Home Assistant helper: verify-version'
description: 'GitHub action helper: verify-version'
inputs:
ignore-dev:
description: Skip check if the branch is 'dev'
required: false
default: false
ignore-master:
description: Skip check if the branch is 'master'
required: false
default: false
runs:
using: "composite"
steps:
- shell: bash
env:
INPUTS_IGNORE_DEV: ${{ inputs.ignore-dev }}
INPUTS_IGNORE_MASTER: ${{ inputs.ignore-master }}
ACTION_PATH: ${{ github.action_path }}
REF: ${{ github.event_name == 'release' && github.event.release.tag_name || github.ref }}
UV_SYSTEM_PYTHON: "true"
run: |
pip install uv
uv pip install tomli
setup_version="$(python3 $ACTION_PATH/../read_version.py)"
branch_version=$(echo "$REF" | awk -F"/" '{print $NF}' )
if [[ "${branch_version}" == "" ]]; then
echo "::error::Verson is empty"
exit 1
fi
if [[ "$INPUTS_IGNORE_DEV" =~ true|True ]] && [ "${branch_version}" == "dev" ]; then
exit 0
elif [[ "$INPUTS_IGNORE_MASTER" =~ true|True ]] && [ "${branch_version}" == "master" ]; then
exit 0
elif [ "${setup_version}" != "${branch_version}" ]; then
echo "Version of tag ${branch_version} don't match with ${setup_version}!"
exit 1
fi