From f2f9f29eda527582196707579962582d98eb9a79 Mon Sep 17 00:00:00 2001 From: Arno Rossouw <arno@bob.co.za> Date: Mon, 4 Nov 2024 14:40:45 +0200 Subject: [PATCH] 8-INFRASTRUCTURE :: gitlab ci for production branch --- .gitlab-ci.yml | 27 +++++++++++++++++++++++++++ composer.json | 2 +- etc/module.xml | 2 +- package.json | 2 +- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bc49012..aff1972 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,3 +21,30 @@ deploy: rules: - if: '$CI_COMMIT_BRANCH == "dev" && $CI_COMMIT_TAG == null' when: always + +prod_deploy: + stage: deploy + before_script: + - AWS_ACCESS_KEY_ID_KEY=$(echo "$CI_COMMIT_BRANCH"_"AWS_ACCESS_KEY_ID") + - AWS_ACCESS_KEY_ID=$(eval echo -e "\$$AWS_ACCESS_KEY_ID_KEY") + - AWS_SECRET_ACCESS_KEY_KEY=$(echo "$CI_COMMIT_BRANCH"_"AWS_SECRET_ACCESS_KEY") + - AWS_SECRET_ACCESS_KEY=$(eval echo -e "\$$AWS_SECRET_ACCESS_KEY_KEY") + - export AWS_ACCESS_KEY_ID + - export AWS_SECRET_ACCESS_KEY + # Fetch the prod branch + - git fetch origin prod + # Check if the tagged commit is from the prod branch + - if git merge-base --is-ancestor "${CI_COMMIT_SHA}" origin/prod; then + echo "Tag ${CI_COMMIT_TAG} is from prod branch."; + else + echo "Tag ${CI_COMMIT_TAG} is not from prod branch."; + exit 1; + fi + script: + - ./make-zip.sh + - aws s3 cp bobgo-magento-plugin.zip s3://bobgo-s3-magento-plugin-prod/ --region=af-south-1 + allow_failure: false + rules: + - if: '$CI_COMMIT_TAG' + when: on_success + - when: never diff --git a/composer.json b/composer.json index 7962a85..af2ae11 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.36", + "version": "1.0.37", "authors": [ { "name": "Bob Go", diff --git a/etc/module.xml b/etc/module.xml index 6a1ae04..d49e765 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.36"> + <module name="BobGroup_BobGo" setup_version="1.0.37"> <sequence> <module name="Magento_Webapi"/> <module name="Magento_Catalog"/> diff --git a/package.json b/package.json index 91a85bc..bb53460 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "bobgo-magento-plugin", "description": "Bob Go magento plugin", - "version": "1.0.36", + "version": "1.0.37", "license": "GPL-2.0-or-later", "scripts": { "prepare": "husky install", -- GitLab