mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-12 09:00:32 +02:00
change tag update from version to upstream
This commit is contained in:
@@ -16,9 +16,9 @@ git config --system user.password ${GITPASS}
|
||||
git config --system user.email ${GITMAIL}
|
||||
|
||||
if bashio::config.has_value 'gitapi'; then
|
||||
LOGINFO="... setting github API" && if [ $VERBOSE = true ]; then bashio::log.info $LOGINFO; fi
|
||||
LOGINFO="... setting github API" && if [ $VERBOSE = true ]; then bashio::log.info $LOGINFO; fi
|
||||
|
||||
export GITHUB_API_TOKEN=$(bashio::config 'gitapi')
|
||||
export GITHUB_API_TOKEN=$(bashio::config 'gitapi')
|
||||
fi
|
||||
|
||||
LOGINFO="... parse addons" && if [ $VERBOSE = true ]; then bashio::log.info $LOGINFO; fi
|
||||
@@ -48,16 +48,16 @@ for addons in $(bashio::config "addon|keys"); do
|
||||
|
||||
#Find current version
|
||||
LOGINFO="... $SLUG : get current version" && if [ $VERBOSE = true ]; then bashio::log.info $LOGINFO; fi
|
||||
CURRENT=$(jq .version config.json) || bashio::log.error "$SLUG addon version in config.json not found. Exiting." exit
|
||||
CURRENT=$(jq .upstream config.json) || bashio::log.error "$SLUG addon upstream tag not found in config.json. Exiting." exit
|
||||
|
||||
#Prepare tag flag
|
||||
if [ ${FULLTAG} = true ]; then
|
||||
LOGINFO="... $SLUG : fulltag is on" && if [ $VERBOSE = true ]; then bashio::log.info $LOGINFO; fi
|
||||
FULLTAG="--format tag"
|
||||
else
|
||||
LOGINFO="... $SLUG : fulltag is off" && if [ $VERBOSE = true ]; then bashio::log.info $LOGINFO; fi
|
||||
FULLTAG=""
|
||||
fi
|
||||
#Prepare tag flag
|
||||
if [ ${FULLTAG} = true ]; then
|
||||
LOGINFO="... $SLUG : fulltag is on" && if [ $VERBOSE = true ]; then bashio::log.info $LOGINFO; fi
|
||||
FULLTAG="--format tag"
|
||||
else
|
||||
LOGINFO="... $SLUG : fulltag is off" && if [ $VERBOSE = true ]; then bashio::log.info $LOGINFO; fi
|
||||
FULLTAG=""
|
||||
fi
|
||||
|
||||
#If beta flag, select beta version
|
||||
if [ ${BETA} = true ]; then
|
||||
@@ -68,9 +68,6 @@ fi
|
||||
LASTVERSION=$(lastversion "https://github.com/$UPSTREAM" $FULLTAG)
|
||||
fi
|
||||
|
||||
# Take only into account first part of tag
|
||||
# CURRENT=${CURRENT:0:${#LASTVERSION}}
|
||||
|
||||
# Add brackets
|
||||
LASTVERSION='"'$LASTVERSION'"'
|
||||
|
||||
@@ -80,7 +77,8 @@ fi
|
||||
|
||||
#Change all instances of version
|
||||
LOGINFO="... $SLUG : updating files" && if [ $VERBOSE = true ]; then bashio::log.info $LOGINFO; fi
|
||||
files=$(grep -rl ${CURRENT} /data/${BASENAME}/${SLUG}) && echo $files | xargs sed -i "s/${CURRENT}/${LASTVERSION}/g"
|
||||
files=$(grep -rl ${CURRENT} /data/${BASENAME}/${SLUG}) && echo $files | xargs sed -i "s/${CURRENT}/${LASTVERSION}/g" # change all tags in all addon files
|
||||
jq --arg LASTVERSION "$LASTVERSION" '.upstream = $LASTVERSION' /data/${BASENAME}/${SLUG}/config.json # Correct config upstream
|
||||
|
||||
#Update changelog
|
||||
touch /data/${BASENAME}/${SLUG}/CHANGELOG.md
|
||||
@@ -88,7 +86,7 @@ fi
|
||||
sed -i "1i\## ${LASTVERSION:1:-1}" /data/${BASENAME}/${SLUG}/CHANGELOG.md
|
||||
sed -i "1i\ " /data/${BASENAME}/${SLUG}/CHANGELOG.md
|
||||
|
||||
if [ $files != null ]; then
|
||||
if [ $files != null ]; then
|
||||
git commit -m "Update to $LASTVERSION" $files || true
|
||||
git commit -m "Update to $LASTVERSION" /data/${BASENAME}/${SLUG}/CHANGELOG.md || true
|
||||
|
||||
@@ -99,9 +97,9 @@ if [ $files != null ]; then
|
||||
|
||||
#Log
|
||||
bashio::log.info "$SLUG updated to $LASTVERSION"
|
||||
else
|
||||
bashio::log.error "... $SLUG : update failed"
|
||||
fi
|
||||
else
|
||||
bashio::log.error "... $SLUG : update failed"
|
||||
fi
|
||||
|
||||
else
|
||||
bashio::log.info "Addon $SLUG is already up-to-date"
|
||||
|
||||
Reference in New Issue
Block a user