[PLA-2087] Catch all handlers (#68) #43
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: | |
push: | |
pull_request: | |
concurrency: | |
group: check-version-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: check | |
run: | | |
# Fetch the version from Cargo.toml | |
version=$(grep -m 1 '^version' Cargo.toml | sed 's/version = "\(.*\)"/\1/') | |
# Fetch the JSON data using curl | |
json_data=$(curl -s https://api.github.com/repos/enjin/wallet-daemon/releases/latest) | |
# Extract the tag_name and remove the leading 'v' | |
compare_version=$(echo "$json_data" | jq -r '.tag_name' | sed 's/^v//') | |
# Compare versions | |
if [ "$(printf '%s\n' "$version" "$compare_version" | sort -V | head -n 1)" = "$version" ]; then | |
if [ "$version" != "$compare_version" ]; then | |
echo "The version in Cargo.toml ($version) is lower than $compare_version" | |
exit 1 | |
else | |
echo "The version in Cargo.toml ($version) is equal to $compare_version" | |
exit 1 | |
fi | |
else | |
echo "The version in Cargo.toml ($version) is higher than $compare_version" | |
fi |