diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f8e0203e993513e59c596ce44ed99a4691421e4b..a8ea2ed73fbb1c604004630d23445f0bb8cd0b73 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,15 +33,18 @@ tag_deploy: - AWS_SECRET_ACCESS_KEY=$(eval echo -e "\$$AWS_SECRET_ACCESS_KEY_KEY") - export AWS_ACCESS_KEY_ID - export AWS_SECRET_ACCESS_KEY - - git fetch origin prod - - TAG_BRANCH=$(git for-each-ref --format='%(refname:short)' --contains $CI_COMMIT_SHA refs/heads/ | grep "^prod$" || echo "") - - echo "Current branches containing this commit: $(git for-each-ref --format='%(refname:short)' --contains $CI_COMMIT_SHA refs/heads/)" + # Ensure all branches and tags are fetched + - echo "Fetching all branches and tags..." + - git fetch --all + - git fetch --tags + # Verify the branch of origin for the tag - | - if [ -z "$TAG_BRANCH" ]; then - echo "Tag ${CI_COMMIT_TAG} was not created on the prod branch." - exit 1 + branch=$(git branch -r --contains "${CI_COMMIT_SHA}" | grep -v 'tags/' | awk '{print $1}' | sed 's/origin\///' | head -n 1) + if [ "$branch" = "prod" ]; then + echo "Tag ${CI_COMMIT_TAG} is from the prod branch."; else - echo "Tag ${CI_COMMIT_TAG} was created on the prod branch." + echo "Tag ${CI_COMMIT_TAG} is not from the prod branch. It was created from the '${branch}' branch."; + exit 1; fi script: - "TAG_ARCHIVE_URL=https://gitlab.bob.co.za/bob-public-utils/bobgo-magento-extension/-/archive/${CI_COMMIT_TAG}/bobgo-magento-extension-${CI_COMMIT_TAG}.zip" diff --git a/composer.json b/composer.json index d4423e2daabe2ef0f00c0a21a96047f1252c7aed..ffbe05843a6b2ed57efe4a27bc98480798cd74e5 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "bobgo/bobgo-magento-extension", "description": "Smart shipping and order management solution in South Africa", "type": "magento2-module", - "version": "1.0.55", + "version": "1.0.56", "authors": [ { "name": "Bob Go", diff --git a/etc/module.xml b/etc/module.xml index 1360275cad21e2d48be4c57df3ac1caad6feb2b0..e6f0120668ae32655f43079b70c5dff5bdc39133 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -7,7 +7,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="BobGroup_BobGo" setup_version="1.0.55"> + <module name="BobGroup_BobGo" setup_version="1.0.56"> <sequence> <module name="Magento_Webapi"/> <module name="Magento_Catalog"/> diff --git a/package.json b/package.json index e61154644460992ae5a22a36fce11a82fda54aa3..3d9d7da78cb2a475296eb70c5aa218669c67f00b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "bobgo-magento-plugin", "description": "Bob Go magento plugin", - "version": "1.0.55", + "version": "1.0.56", "license": "GPL-2.0-or-later", "scripts": { "prepare": "husky install",