mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-03 11:50: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}
|
git config --system user.email ${GITMAIL}
|
||||||
|
|
||||||
if bashio::config.has_value 'gitapi'; then
|
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
|
fi
|
||||||
|
|
||||||
LOGINFO="... parse addons" && if [ $VERBOSE = true ]; then bashio::log.info $LOGINFO; 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
|
#Find current version
|
||||||
LOGINFO="... $SLUG : get current version" && if [ $VERBOSE = true ]; then bashio::log.info $LOGINFO; fi
|
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
|
#Prepare tag flag
|
||||||
if [ ${FULLTAG} = true ]; then
|
if [ ${FULLTAG} = true ]; then
|
||||||
LOGINFO="... $SLUG : fulltag is on" && if [ $VERBOSE = true ]; then bashio::log.info $LOGINFO; fi
|
LOGINFO="... $SLUG : fulltag is on" && if [ $VERBOSE = true ]; then bashio::log.info $LOGINFO; fi
|
||||||
FULLTAG="--format tag"
|
FULLTAG="--format tag"
|
||||||
else
|
else
|
||||||
LOGINFO="... $SLUG : fulltag is off" && if [ $VERBOSE = true ]; then bashio::log.info $LOGINFO; fi
|
LOGINFO="... $SLUG : fulltag is off" && if [ $VERBOSE = true ]; then bashio::log.info $LOGINFO; fi
|
||||||
FULLTAG=""
|
FULLTAG=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#If beta flag, select beta version
|
#If beta flag, select beta version
|
||||||
if [ ${BETA} = true ]; then
|
if [ ${BETA} = true ]; then
|
||||||
@@ -68,9 +68,6 @@ fi
|
|||||||
LASTVERSION=$(lastversion "https://github.com/$UPSTREAM" $FULLTAG)
|
LASTVERSION=$(lastversion "https://github.com/$UPSTREAM" $FULLTAG)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Take only into account first part of tag
|
|
||||||
# CURRENT=${CURRENT:0:${#LASTVERSION}}
|
|
||||||
|
|
||||||
# Add brackets
|
# Add brackets
|
||||||
LASTVERSION='"'$LASTVERSION'"'
|
LASTVERSION='"'$LASTVERSION'"'
|
||||||
|
|
||||||
@@ -80,7 +77,8 @@ fi
|
|||||||
|
|
||||||
#Change all instances of version
|
#Change all instances of version
|
||||||
LOGINFO="... $SLUG : updating files" && if [ $VERBOSE = true ]; then bashio::log.info $LOGINFO; fi
|
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
|
#Update changelog
|
||||||
touch /data/${BASENAME}/${SLUG}/CHANGELOG.md
|
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\## ${LASTVERSION:1:-1}" /data/${BASENAME}/${SLUG}/CHANGELOG.md
|
||||||
sed -i "1i\ " /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" $files || true
|
||||||
git commit -m "Update to $LASTVERSION" /data/${BASENAME}/${SLUG}/CHANGELOG.md || true
|
git commit -m "Update to $LASTVERSION" /data/${BASENAME}/${SLUG}/CHANGELOG.md || true
|
||||||
|
|
||||||
@@ -99,9 +97,9 @@ if [ $files != null ]; then
|
|||||||
|
|
||||||
#Log
|
#Log
|
||||||
bashio::log.info "$SLUG updated to $LASTVERSION"
|
bashio::log.info "$SLUG updated to $LASTVERSION"
|
||||||
else
|
else
|
||||||
bashio::log.error "... $SLUG : update failed"
|
bashio::log.error "... $SLUG : update failed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
bashio::log.info "Addon $SLUG is already up-to-date"
|
bashio::log.info "Addon $SLUG is already up-to-date"
|
||||||
|
|||||||
Reference in New Issue
Block a user