-
Notifications
You must be signed in to change notification settings - Fork 10
38 lines (32 loc) · 1.29 KB
/
check-version.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
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