Skip to content

Commit

Permalink
feat: Force-push sliding tag (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmarek-kindred authored May 27, 2024
1 parent 7eb2530 commit 41ee77b
Showing 1 changed file with 25 additions and 29 deletions.
54 changes: 25 additions & 29 deletions bin/ghcr-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,41 @@ isNumber() {
fi
}

push_tag() {
dockerBuildTagPush() {
echo "all args = $@"
application=$1
version=$2
isSlidingTag=$3
additionalTag=$3

tagWithVersion=$application:$version
echo "application=${application} version=${version} shouldBuild=${shouldBuild} additionalTag=${additionalTag}"

tagWithVersion="$application:$version"
echo "tagWithVersion=${tagWithVersion}"

tagRef=ghcr.io/kindredgroup/pit-toolkit/$tagWithVersion
tagRef="ghcr.io/kindredgroup/pit-toolkit/$tagWithVersion"
shortTagRef="ghcr.io/kindredgroup/pit-toolkit/$application:$additionalTag"
appRef="ghcr.io/kindredgroup/pit-toolkit/$application"

echo "tagRef=${tagRef}"
echo ""

pwd
echo ""
ls -lah
echo ""
echo "Docker images before tagging...."
docker images

echo "docker build --tag $tagRef ."
docker build --tag "${tagRef}" .

echo "docker push ${tagRef}"
docker push "${tagRef}"
if [ "${additionalTag}" != "" ];
then
echo "shortTagRef=${shortTagRef}"
docker tag "${tagRef}" "${shortTagRef}"
fi

echo "Docker images after tagging...."
docker images

echo "docker push -a ${appRef}"
docker push -a "${appRef}"
echo ""
}

Expand All @@ -54,7 +66,7 @@ echo "cd $application"
cd $application
if [ "${makeAdditionalTag}" == "n" ];
then
push_tag "${application}" "${version}"
dockerBuildTagPush "${application}" "${version}"
exit 0
fi

Expand Down Expand Up @@ -94,25 +106,9 @@ fi
majorMinorVersion="${array[0]}.${array[1]}"
echo "Computed majorMinorVersion=${majorMinorVersion}"

dockerBuildTagPush "${application}" "${version}" "${majorMinorVersion}"


tagWithVersion=$application:$version
echo "tagWithVersion=${tagWithVersion}"
tagRef=ghcr.io/kindredgroup/pit-toolkit/$tagWithVersion
echo "tagRef=${tagRef}"
echo ""

echo "docker build --tag $tagRef ."
docker build --tag "${tagRef}" .
shortTagRef=ghcr.io/kindredgroup/pit-toolkit/$application:$majorMinorVersion
docker tag "${tagRef}" "${shortTagRef}"
docker images

echo "push -a ghcr.io/kindredgroup/pit-toolkit/$application"
echo "-- before pushing docker iamge --"
docker push -q -a "ghcr.io/kindredgroup/pit-toolkit/$application"
echo "-- after pushing docker iamge --"
cd $home
git tag -f "${majorMinorVersion}"
git push origin tag "${majorMinorVersion}"
git push -f origin tag "${majorMinorVersion}"
echo ""

0 comments on commit 41ee77b

Please sign in to comment.