Skip to content

Commit

Permalink
ci: Added build and draft release job
Browse files Browse the repository at this point in the history
Added package version bump check
  • Loading branch information
Nyoxis committed Mar 6, 2024
1 parent 22ef5fe commit fbd1076
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 39 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/rust-check-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ jobs:
)" >> $GITHUB_ENV
- name: Check which version is greater
run: echo "GREATER_VER=$(./vergt.sh $VERSION $BEFORE_VERSION)" >> $GITHUB_ENV

- name: Fail if current version is not greater
run: exit 1
if: ${{ env.GREATER_VER != 1 }}
run: ./vergt.sh $VERSION $BEFORE_VERSION

cargo-build:
name: Cargo build
Expand Down
31 changes: 31 additions & 0 deletions is_version_greater.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
IFS=.
version=($1)
before_version=($2)
# starting from minor of version if version shorter before_version
# fill absent fields in version with zeros
for ((i=${#version[@]}; i<${#before_version[@]}; i++))
do
version[i]=0
done
# starting from major of version
for ((i=0; i<${#version[@]}; i++))
do
if [[ -z ${before_version[i]} ]]
then
# if before_version shorter version then
# fill absent fields in before_version with zeros
ver2[i]=0
fi
if ((10#${version[i]} > 10#${before_version[i]}))
then
# if version greater than before_version in most major differing field
exit 0
fi
if ((10#${version[i]} < 10#${before_version[i]}))
then
# if version is not greater in most major differing field
exit 1
fi
done
exit 1
34 changes: 0 additions & 34 deletions vergt.sh

This file was deleted.

0 comments on commit fbd1076

Please sign in to comment.