self update tag release updates

This commit is contained in:
Heavybullets8 2022-08-23 12:37:16 -06:00
parent 3a8eabd579
commit 9e0e40c122
2 changed files with 5 additions and 4 deletions

View File

@ -2,14 +2,15 @@
args=("$@") args=("$@")
self_update() { self_update() {
branch="main"
latest_ver=$(git describe --tags "$(git rev-list --tags --max-count=1)")
git fetch &> /dev/null git fetch &> /dev/null
echo "🅂 🄴 🄻 🄵" echo "🅂 🄴 🄻 🄵"
echo "🅄 🄿 🄳 🄰 🅃 🄴" echo "🅄 🄿 🄳 🄰 🅃 🄴"
if git diff --name-only origin/$branch | grep -qs ".sh" ; then if [[ "$hs_version" != "$latest_ver" ]] ; then
echo "Found a new version of HeavyScript, updating myself..." echo "Found a new version of HeavyScript, updating myself..."
git reset --hard -q git reset --hard -q
git pull --force -q git checkout "$(latest_ver)"
count=0 count=0
for i in "${args[@]}" for i in "${args[@]}"
do do

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
#Version #Version
hs_version=$(curl --silent "https://api.github.com/repos/HeavyBullets8/heavy_script/releases/latest" | jq -r .tag_name) hs_version=$(git describe --tags)
# cd to script, this ensures the script can find the source scripts below, even when ran from a seperate directory # cd to script, this ensures the script can find the source scripts below, even when ran from a seperate directory
script=$(readlink -f "$0") script=$(readlink -f "$0")