mirror of
https://github.com/gotson/komga.git
synced 2026-04-20 14:04:08 +02:00
Travis deploy script to push the same image for latest and semver on Dockerhub (push latest only if semver is highest)
no need to manage latest tag on git repo anymore
This commit is contained in:
parent
0c179b25f7
commit
eae425e6d3
2 changed files with 25 additions and 8 deletions
|
|
@ -20,14 +20,7 @@ deploy:
|
|||
branch: master
|
||||
|
||||
- provider: script
|
||||
script: ./gradlew dockerPushLatest
|
||||
skip_cleanup: true
|
||||
on:
|
||||
tags: true
|
||||
condition: $TRAVIS_TAG = latest
|
||||
|
||||
- provider: script
|
||||
script: ./gradlew dockerPushSemVer
|
||||
script: bash ./.travis/deploy-semver.sh
|
||||
skip_cleanup: true
|
||||
on:
|
||||
tags: true
|
||||
|
|
|
|||
24
.travis/deploy-semver.sh
Normal file
24
.travis/deploy-semver.sh
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
vergte() {
|
||||
[ "$1" = "$(echo -e "$1\n$2" | sort -rV | head -n1)" ]
|
||||
}
|
||||
|
||||
vergt() {
|
||||
[ "$1" = "$2" ] && return 1 || vergte $1 $2
|
||||
}
|
||||
|
||||
HIGHEST_TAG=$(curl -sk https://api.github.com/repos/gotson/komga/tags | jq -r '.[].name' | grep ^v | tr -d v | sort -rV | head -n1)
|
||||
CURRENT_TAG=$(echo ${TRAVIS_TAG} | tr -d v)
|
||||
|
||||
echo HIGHEST_TAG version: ${HIGHEST_TAG}
|
||||
echo CURRENT_TAG version: ${CURRENT_TAG}
|
||||
|
||||
if vergte ${CURRENT_TAG} ${HIGHEST_TAG}
|
||||
then
|
||||
echo Current tag is highest, deploying SemVer and Latest
|
||||
./gradlew dockerPushLatest dockerPushSemVer
|
||||
else
|
||||
echo Current tag is not highest, deploying SemVer only
|
||||
./gradlew dockerPushSemVer
|
||||
fi
|
||||
Loading…
Reference in a new issue