mirror of
https://github.com/letic/Shell-Scripts.git
synced 2024-09-28 05:56:04 +00:00
Create ci-git-tag-compared-to-release.sh
This commit is contained in:
parent
feb5f11c97
commit
4d8f435bac
28
ci-git-tag-compared-to-release.sh
Normal file
28
ci-git-tag-compared-to-release.sh
Normal file
@ -0,0 +1,28 @@
|
||||
latest_release=$(curl \
|
||||
--cert /etc/pki/tls/certs/client.crt \
|
||||
--key /etc/pki/tls/private/client.key \
|
||||
--header 'Content-Type: application/json' \
|
||||
--silent \
|
||||
https://my.api.com/component/foo/releases | \
|
||||
grep -Eo '"version": "[[:digit:]]+' | \
|
||||
cut -d : -f 2 | \
|
||||
cut -d '"' -f 2 | \
|
||||
head -n 1)
|
||||
|
||||
tag=$(git tag | tail -n 1)
|
||||
|
||||
if [ $tag -le $latest_release ]; then
|
||||
echo 1 > status
|
||||
echo "The latest tag ($tag) is less than, or equal to, the latest release ($latest_release) so no point in building a new release"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "DO STUFF"
|
||||
|
||||
# In another Jenkins shell block...
|
||||
|
||||
if [ $(cat status) -eq 1 ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "OTHERWISE DO STUFF"
|
Loading…
Reference in New Issue
Block a user