From 7eb2530b75df666c89c4620b35d5306e426a467d Mon Sep 17 00:00:00 2001 From: fmarek-kindred <123923685+fmarek-kindred@users.noreply.github.com> Date: Mon, 27 May 2024 20:04:59 +1000 Subject: [PATCH] fix: Prepare for 1.2 release (#34) fix: Prepare for 1.2 release (#34) --- .github/workflows/ghcr_publish.yml | 10 +++++++--- bin/ghcr-publish.sh | 26 ++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ghcr_publish.yml b/.github/workflows/ghcr_publish.yml index 80b6637..4501913 100644 --- a/.github/workflows/ghcr_publish.yml +++ b/.github/workflows/ghcr_publish.yml @@ -7,7 +7,7 @@ name: ghcr.io Publish on: push: tags: - - 'v[0-9]+.[0-9]+.[0-9]' + - 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+-[a-zA-Z]+' - 'v[0-9]+.[0-9]+.[0-9]+(-[a-zA-Z]+)+.[0-9]?' @@ -33,7 +33,11 @@ jobs: echo $RELEASE_VERSION echo ${{ env.RELEASE_VERSION }} - name: Build and publish "Lock Manager" image - run: bash bin/ghcr-publish.sh lock-manager $RELEASE_VERSION "y" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: bash bin/ghcr-publish.sh lock-manager $RELEASE_VERSION "y" $GITHUB_TOKEN - name: Build and publish "Brownie" image - run: bash bin/ghcr-publish.sh brownie $RELEASE_VERSION "y" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: bash bin/ghcr-publish.sh brownie $RELEASE_VERSION "y" $GITHUB_TOKEN diff --git a/bin/ghcr-publish.sh b/bin/ghcr-publish.sh index 6fedbe9..fa255d3 100755 --- a/bin/ghcr-publish.sh +++ b/bin/ghcr-publish.sh @@ -5,6 +5,7 @@ set -e application=$1 version=$2 makeAdditionalTag=$3 +gitHubToken=$4 if [ "${makeAdditionalTag}" == "" ]; then @@ -26,6 +27,7 @@ push_tag() { echo "all args = $@" application=$1 version=$2 + isSlidingTag=$3 tagWithVersion=$application:$version echo "tagWithVersion=${tagWithVersion}" @@ -41,6 +43,7 @@ push_tag() { echo "docker build --tag $tagRef ." docker build --tag "${tagRef}" . + echo "docker push ${tagRef}" docker push "${tagRef}" echo "" @@ -49,10 +52,9 @@ push_tag() { home=$(pwd) echo "cd $application" cd $application -push_tag "${application}" "${version}" - if [ "${makeAdditionalTag}" == "n" ]; then + push_tag "${application}" "${version}" exit 0 fi @@ -92,9 +94,25 @@ fi majorMinorVersion="${array[0]}.${array[1]}" echo "Computed majorMinorVersion=${majorMinorVersion}" -push_tag "${application}" "${majorMinorVersion}" -cd $home +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}" +echo ""