Skip to content

Update Cargo.toml

Update Cargo.toml #13

Workflow file for this run

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@v1
- 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