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..60bb31c 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,26 @@ push_tag() { echo "docker build --tag $tagRef ." docker build --tag "${tagRef}" . + + # # after we successfully build the image we can push the tag + # if [ "${isSlidingTag}" == "true" ]; + # then + # echo "Fetching versions tag ${version}" + # curl -v -L \ + # -X GET \ + # -H "Accept: application/vnd.github+json" \ + # -H "Authorization: Bearer ${gitHubToken}" \ + # -H "X-GitHub-Api-Version: 2022-11-28" \ + # "https://api.github.com/user/packages/container/kindredgroup/pit-toolkit/$application/versions" + # echo "Removing previous sliding tag ${version}" + # curl -L \ + # -X DELETE \ + # -H "Accept: application/vnd.github+json" \ + # -H "Authorization: Bearer ${gitHubToken}" \ + # -H "X-GitHub-Api-Version: 2022-11-28" \ + # "https://api.github.com/user/packages/container/kindredgroup/pit-toolkit/$application/$version" + # fi + echo "docker push ${tagRef}" docker push "${tagRef}" echo "" @@ -49,10 +71,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 +113,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 "" diff --git a/brownie/package-lock.json b/brownie/package-lock.json index 2e54edd..da940fb 100644 --- a/brownie/package-lock.json +++ b/brownie/package-lock.json @@ -1,12 +1,12 @@ { "name": "brownie", - "version": "1.1.9-dev", + "version": "1.1.10-dev", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "brownie", - "version": "1.1.9-dev", + "version": "1.1.10-dev", "license": "MIT", "dependencies": { "kafkajs": "^2.2.4", diff --git a/brownie/package.json b/brownie/package.json index 3a99833..235ba36 100644 --- a/brownie/package.json +++ b/brownie/package.json @@ -1,6 +1,6 @@ { "name": "brownie", - "version": "1.1.9-dev", + "version": "1.1.10-dev", "description": "The resource cleanup application of PIT toolkit", "type": "module", "main": "dist/index.js", diff --git a/k8s-deployer/package-lock.json b/k8s-deployer/package-lock.json index 3590b7e..9400c9d 100644 --- a/k8s-deployer/package-lock.json +++ b/k8s-deployer/package-lock.json @@ -1,12 +1,12 @@ { "name": "@kindredgroup/pit-k8s-deployer", - "version": "1.1.9-dev", + "version": "1.1.10-dev", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@kindredgroup/pit-k8s-deployer", - "version": "1.1.9-dev", + "version": "1.1.10-dev", "license": "MIT", "dependencies": { "ajv": "^8.12.0", diff --git a/k8s-deployer/package.json b/k8s-deployer/package.json index 3417775..bfccddc 100644 --- a/k8s-deployer/package.json +++ b/k8s-deployer/package.json @@ -1,6 +1,6 @@ { "name": "@kindredgroup/pit-k8s-deployer", - "version": "1.1.9-dev", + "version": "1.1.10-dev", "description": "The deployment utility for apps designed to run in K8s clusters", "type": "module", "main": "dist/index.js", diff --git a/lock-manager/package-lock.json b/lock-manager/package-lock.json index 3207aae..13621a4 100644 --- a/lock-manager/package-lock.json +++ b/lock-manager/package-lock.json @@ -1,12 +1,12 @@ { "name": "lock-manager", - "version": "1.1.9-dev", + "version": "1.1.10-dev", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "lock-manager", - "version": "1.1.9-dev", + "version": "1.1.10-dev", "license": "MIT", "dependencies": { "express": "^4.18.2", diff --git a/lock-manager/package.json b/lock-manager/package.json index a9b01be..b9fb85a 100644 --- a/lock-manager/package.json +++ b/lock-manager/package.json @@ -1,6 +1,6 @@ { "name": "lock-manager", - "version": "1.1.9-dev", + "version": "1.1.10-dev", "description": "The lock manager application of PIT toolkit", "type": "module", "main": "dist/index.js",