From f16d84c6a8360d82ff53845897632f7f0ab9ab70 Mon Sep 17 00:00:00 2001 From: Vishal Khode Date: Fri, 29 Nov 2024 18:35:49 +0530 Subject: [PATCH 1/5] ACMS-4329: New CD workflow added. --- .github/cd.gitignore | 11 ++ .github/workflows/deployment.workflow.yml | 142 ++++++++++++++++++++++ composer.json | 17 +-- composer.lock | 82 +++++++++---- 4 files changed, 216 insertions(+), 36 deletions(-) create mode 100644 .github/cd.gitignore create mode 100644 .github/workflows/deployment.workflow.yml diff --git a/.github/cd.gitignore b/.github/cd.gitignore new file mode 100644 index 000000000..44d8613c7 --- /dev/null +++ b/.github/cd.gitignore @@ -0,0 +1,11 @@ +/docroot/sites/*/settings.*.php +/docroot/sites/*/services*.yml +/docroot/sites/*/files +/docroot/sites/*/private +/docroot/sites/simpletest + +# Directories specific to this template +/docroot/libraries +/docroot/modules/contrib +/docroot/profiles/contrib +/docroot/themes/contrib diff --git a/.github/workflows/deployment.workflow.yml b/.github/workflows/deployment.workflow.yml new file mode 100644 index 000000000..6faa617c2 --- /dev/null +++ b/.github/workflows/deployment.workflow.yml @@ -0,0 +1,142 @@ +name: "Code Deployment on Acquia Environment" +on: + push: + branches: [ develop, main ] +jobs: + acquia_code_deployment: + if: ${{ github.event_name == 'push' }} + name: "Code Deployment on Acquia Environment" + env: + GIT_AUTHOR_NAME: "Vishal Khode" + GIT_COMMITTER_NAME: "Vishal Khode" + GIT_COMMITTER_EMAIL: "vishal.khode@acquia.com" + GIT_AUTHOR_EMAIL: "vishal.khode@acquia.com" + runs-on: ubuntu-latest + environment: acquia_code_deployment + concurrency: production + steps: + - uses: actions/checkout@v4 + - uses: shivammathur/setup-php@v2 + with: + php-version: 8.3 + - name: Configure SSH keys + run: | + mkdir -p ~/.ssh + echo "${ACQUIA_CLOUD_SSH_PRIVATE_KEY}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + eval `ssh-agent -s` + ssh-add ~/.ssh/id_rsa + + # Loop through each line in the environment variable. + echo "${ACQUIA_CLOUD_KNOWN_HOSTS}" | while IFS= read -r KNOWN_HOST; do + if [[ -n "${KNOWN_HOST}" ]]; then + CLEANED_HOST=$(echo "${KNOWN_HOST}" | tr -d '\r' | xargs -n1) + ssh-keyscan "${CLEANED_HOST}" >> ~/.ssh/known_hosts 2>/dev/null || { + echo "Warning: Unable to scan host ${CLEANED_HOST}. Skipping." + } + fi + done + shell: bash + env: + ACQUIA_CLOUD_SSH_PRIVATE_KEY: ${{ secrets.ACQUIA_CLOUD_SSH_PRIVATE_KEY }} + ACQUIA_CLOUD_KNOWN_HOSTS: ${{ vars.ACQUIA_CLOUD_KNOWN_HOSTS }} + - name: Setup Drupal Project + run: | + # Install specific version of Drupal Core. + composer require drupal/core:${CORE_VERSION} drupal/core-composer-scaffold:${CORE_VERSION} drupal/core-recommended:${CORE_VERSION} --no-install --no-update -n + + # Move some of development dependencies to production depencies or else acli push:artifact will fail. + composer require oomphinc/composer-installers-extender --no-install --no-update -n + composer update "drupal/core-*" drush/drush "drupal/*" -W --with=drupal/core:${CORE_VERSION} --minimal-changes + + # Include MySQL 5.7 connection settings, before DRS require line is added. + echo "require DRUPAL_ROOT . '/modules/contrib/mysql57/settings.inc';" >> docroot/sites/default/settings.php + + # Download acquia/drupal-recommended-settings plugin & drupal/mysql57 library. + composer require acquia/drupal-recommended-settings:^1.1 drupal/mysql57 + + # Update .gitignore file, otherwise acli won't push any settings file. + sed -i 's/docroot\//docroot\/core/' .gitignore + cat .github/cd.gitignore >> .gitignore 2>/dev/null + + # Create symlink directory for multisite headless and community. + cd docroot/sites + ln -s default headless + ln -s default community + cd - + git add . && git commit -m "Update drupal core and it's dependencies." + env: + CORE_VERSION: ^11 + - name: Setup Acquia CLI + run: | + curl -OL https://github.com/acquia/cli/releases/latest/download/acli.phar + chmod +x acli.phar + mv acli.phar /usr/local/bin/acli + acli --version + + acli auth:login --key=${ACQUIA_CLOUD_API_KEY} --secret=${ACQUIA_CLOUD_API_SECRET} -n + acli link ${ACQUIA_APPLICATION_UUID} -n + acli remote:aliases:download -n + git add . && git commit -m "Added acli & drush alias configurations." + env: + ACQUIA_CLOUD_API_KEY: ${{ secrets.ACQUIA_CLOUD_API_KEY }} + ACQUIA_CLOUD_API_SECRET: ${{ secrets.ACQUIA_CLOUD_API_SECRET }} + ACQUIA_APPLICATION_UUID: ${{ secrets.ACQUIA_APPLICATION_UUID }} + - name: Deploy & Switch Code + shell: bash + run: | + BRANCH_TO_DEPLOY=acli-${GITHUB_REF_NAME} + + acli push:artifact ${ACQUIA_CLOUD_ENVIRONMENT} --destination-git-branch=${BRANCH_TO_DEPLOY} -n + + DEPLOYED_BRANCH=$(acli api:environments:find ${ACQUIA_CLOUD_ENVIRONMENT} -n | jq -r '.vcs.path') + + # If BRANCH_TO_DEPLOY is NOT the same as DEPLOYED_BRANCH. Then switch code. + if [ "$BRANCH_TO_DEPLOY" != "$DEPLOYED_BRANCH" ]; then + # Step 1: Run the code:switch command and capture its output. + response=$(acli api:environments:code-switch ${ACQUIA_CLOUD_ENVIRONMENT} ${BRANCH_TO_DEPLOY} -n) + + # Step 2: Extract the notification ID from the JSON response + notification_id=$(echo "$response" | jq -r '.notification') + + # Step 3: Check if the notification ID was successfully extracted. + if [[ -z "$notification_id" ]]; then + echo "Error: Notification ID not found in the response." + exit 1 + fi + + progress=0 + timeout=1800 # Timeout in seconds (30 minutes). + start_time=$(date +%s) # Get the current time in seconds + + echo "Please wait while code is being switched..." + # Step 4: Poll the notification status until progress reaches 100. + while [[ "$progress" -lt 100 ]]; do + # Run the notification find command. + notification_response=$(acli api:notifications:find "$notification_id" -n) + + # Extract the progress value. + progress=$(echo "$notification_response" | jq -r '.progress') + + # Display current progress. + #echo "Current progress: $progress%" + + # Check if we've exceeded the timeout (5 minutes). + current_time=$(date +%s) + elapsed_time=$((current_time - start_time)) + + if [[ "$elapsed_time" -ge "$timeout" ]]; then + # Calculate minutes and seconds. + minutes=$((elapsed_time / 60)) + seconds=$((elapsed_time % 60)) + + echo "Error: Timeout reached after $minutes minute(s) and $seconds second(s). Progress did not reach 100%." + exit 1 + fi + + # Wait for 5 seconds before polling again. + sleep 5 + done + fi + env: + ACQUIA_CLOUD_ENVIRONMENT: ${{ secrets.ACQUIA_CLOUD_ENVIRONMENT }} diff --git a/composer.json b/composer.json index da7f4231b..dd70c2e6d 100644 --- a/composer.json +++ b/composer.json @@ -223,14 +223,6 @@ } } }, - "consumer_image_styles": { - "type": "vcs", - "url": "https://git.drupalcode.org/issue/consumer_image_styles-3429496.git" - }, - "config_filter": { - "type": "vcs", - "url": "https://git.drupalcode.org/issue/config_filter-3428542.git" - }, "drupal": { "type": "composer", "url": "https://packages.drupal.org/8" @@ -262,8 +254,7 @@ "phpstan/extension-installer": true, "tbachert/spi": true, "webdriver-binary/binary-chromedriver": true, - "wikimedia/composer-merge-plugin": true, - "tbachert/spi": true + "wikimedia/composer-merge-plugin": true }, "preferred-install": { "drupal/core": "dist" @@ -287,8 +278,10 @@ "[web-root]/profiles/README.txt": false, "[web-root]/robots.txt": false, "[web-root]/sites/README.txt": false, - "[web-root]/sites/default/default.settings.php": { - "append": "./patches/d9-acms-settings.patch" + "[web-root]/sites/default/settings.php": { + "mode": "replace", + "overwrite": false, + "path": "docroot/core/assets/scaffold/files/default.settings.php" }, "[web-root]/themes/README.txt": false, "[web-root]/themes/contrib/cohesion-theme/templates/maintenance-page.html.twig": "./patches/maintenance-page.patch", diff --git a/composer.lock b/composer.lock index 3247153fd..11c249435 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "159f1bf0ea74b93f8d8588e5eec5bdcf", + "content-hash": "f7f9e623cf8da30e566ee0d0052fb980", "packages": [ { "name": "acquia/acquia-cms-starterkit", @@ -2390,7 +2390,7 @@ "dist": { "type": "path", "url": "./modules/acquia_cms_common", - "reference": "36ebfe06447b4f28301a18995d197336fb6ce1f3" + "reference": "b2fe6b5717ef5c06a9a978b712bb12252d309a4f" }, "require": { "acquia/drupal-environment-detector": "^1.5", @@ -4010,28 +4010,61 @@ }, { "name": "drupal/consumer_image_styles", - "version": "4.0.8", + "version": "4.0.10", "source": { "type": "git", - "url": "https://git.drupalcode.org/issue/consumer_image_styles-3429496.git", - "reference": "89263183da961c033eb05eb86c2f727df21de7ff" + "url": "https://git.drupalcode.org/project/consumer_image_styles.git", + "reference": "4.0.10" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/consumer_image_styles-4.0.10.zip", + "reference": "4.0.10", + "shasum": "6894d5bde15984a4597e19e6ebab46f464a15b10" }, "require": { - "drupal/consumers": "^1.15", - "drupal/jsonapi_extras": "^3.23" + "drupal/consumers": "^1.19", + "drupal/core": "^9.5 || ^10 || ^11", + "php": ">=8.0" + }, + "require-dev": { + "drupal/jsonapi_extras": "^3.26" }, "type": "drupal-module", + "extra": { + "drupal": { + "version": "4.0.10", + "datestamp": "1729009525", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", "license": [ "GPL-2.0-or-later" ], "authors": [ { "name": "Mateu Aguiló Bosch", + "homepage": "https://www.drupal.org/user/405824", "email": "mateu.aguilo.bosch@gmail.com" + }, + { + "name": "e0ipso", + "homepage": "https://www.drupal.org/user/550110" + }, + { + "name": "japerry", + "homepage": "https://www.drupal.org/user/45640" } ], "description": "Consumer Image Styles integrates with JSON API to provide image styles to your images in your decoupled project.", - "time": "2022-12-09T06:06:46+00:00" + "homepage": "https://www.drupal.org/project/consumer_image_styles", + "support": { + "source": "https://git.drupalcode.org/project/consumer_image_styles" + } }, { "name": "drupal/consumers", @@ -13912,26 +13945,27 @@ }, { "name": "symfony/http-client", - "version": "v7.1.5", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "abca35865118edf35a23f2f24978a1784c831cb4" + "reference": "955e43336aff03df1e8a8e17daefabb0127a313b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/abca35865118edf35a23f2f24978a1784c831cb4", - "reference": "abca35865118edf35a23f2f24978a1784c831cb4", + "url": "https://api.github.com/repos/symfony/http-client/zipball/955e43336aff03df1e8a8e17daefabb0127a313b", + "reference": "955e43336aff03df1e8a8e17daefabb0127a313b", "shasum": "" }, "require": { "php": ">=8.2", "psr/log": "^1|^2|^3", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/http-client-contracts": "^3.4.1", + "symfony/http-client-contracts": "~3.4.3|^3.5.1", "symfony/service-contracts": "^2.5|^3" }, "conflict": { + "amphp/amp": "<2.5", "php-http/discovery": "<1.15", "symfony/http-foundation": "<6.4" }, @@ -13942,14 +13976,14 @@ "symfony/http-client-implementation": "3.0" }, "require-dev": { - "amphp/amp": "^2.5", - "amphp/http-client": "^4.2.1", - "amphp/http-tunnel": "^1.0", + "amphp/http-client": "^4.2.1|^5.0", + "amphp/http-tunnel": "^1.0|^2.0", "amphp/socket": "^1.1", "guzzlehttp/promises": "^1.4|^2.0", "nyholm/psr7": "^1.0", "php-http/httplug": "^1.0|^2.0", "psr/http-client": "^1.0", + "symfony/amphp-http-client-meta": "^1.0|^2.0", "symfony/dependency-injection": "^6.4|^7.0", "symfony/http-kernel": "^6.4|^7.0", "symfony/messenger": "^6.4|^7.0", @@ -13986,7 +14020,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.1.5" + "source": "https://github.com/symfony/http-client/tree/v7.2.0" }, "funding": [ { @@ -14002,20 +14036,20 @@ "type": "tidelift" } ], - "time": "2024-09-20T13:35:23+00:00" + "time": "2024-11-29T08:22:02+00:00" }, { "name": "symfony/http-client-contracts", - "version": "v3.5.0", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "20414d96f391677bf80078aa55baece78b82647d" + "reference": "c2f3ad828596624ca39ea40f83617ef51ca8bbf9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/20414d96f391677bf80078aa55baece78b82647d", - "reference": "20414d96f391677bf80078aa55baece78b82647d", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/c2f3ad828596624ca39ea40f83617ef51ca8bbf9", + "reference": "c2f3ad828596624ca39ea40f83617ef51ca8bbf9", "shasum": "" }, "require": { @@ -14064,7 +14098,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/http-client-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/http-client-contracts/tree/v3.5.1" }, "funding": [ { @@ -14080,7 +14114,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-11-25T12:02:18+00:00" }, { "name": "symfony/http-foundation", From eb859684cc2605c2e89a333cdec36c195a4a8699 Mon Sep 17 00:00:00 2001 From: Vishal Khode Date: Tue, 3 Dec 2024 18:26:29 +0530 Subject: [PATCH 2/5] ACMS-4329: Temp commit to fix CI issue. --- .github/workflows/acquia_cms_ci.workflow.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/acquia_cms_ci.workflow.yml b/.github/workflows/acquia_cms_ci.workflow.yml index a17943db9..cde428f6c 100644 --- a/.github/workflows/acquia_cms_ci.workflow.yml +++ b/.github/workflows/acquia_cms_ci.workflow.yml @@ -9,6 +9,8 @@ on: paths-ignore: - README.md +env: + ORCA_VERSION: ^4 jobs: static_code_analysis: if: ${{ github.event_name == 'pull_request' }} @@ -17,7 +19,6 @@ jobs: # Provide your package's name. ORCA_SUT_NAME: acquia/acquia_cms ORCA_SUT_BRANCH: develop - ORCA_VERSION: ^4 ORCA_PACKAGES_CONFIG_ALTER: ../acquia_cms/tests/packages_alter.yml ORCA_FIXTURE_PROJECT_TEMPLATE: acquia/drupal-recommended-project ORCA_ENABLE_NIGHTWATCH: "FALSE" @@ -151,6 +152,7 @@ jobs: composer create-project --no-dev --ignore-platform-req=php acquia/orca ../orca "$ORCA_VERSION" -n curl https://gist.githubusercontent.com/rajeshreeputra/170586f217b422eb9cdfd9ca9457a2e3/raw/c2f277ba9005b91d7f662cacf37b3940a66a9b8c/sut-path-reposories.patch | git -C ../orca apply curl https://gist.githubusercontent.com/rajeshreeputra/efe6fd50fc839e0e05480a5eb58d1ba4/raw/c5e81aa3c0fba9f4abe42460f3d24c7ca976a527/remove-local-settings.patch | git -C ../orca apply + composer config extra."drupal-scaffold".file-mapping {} --json -d ${ORCA_SUT_DIR} # - name: Configure AWS Credentials # uses: aws-actions/configure-aws-credentials@v1 # with: @@ -255,6 +257,7 @@ jobs: composer self-update composer create-project --no-dev --ignore-platform-req=php acquia/orca ../orca "$ORCA_VERSION" -n curl https://gist.githubusercontent.com/rajeshreeputra/170586f217b422eb9cdfd9ca9457a2e3/raw/c2f277ba9005b91d7f662cacf37b3940a66a9b8c/sut-path-reposories.patch | git -C ../orca apply + composer config extra."drupal-scaffold".file-mapping {} --json -d ${ORCA_SUT_DIR} - name: Before Install run: | # Remove all ExistingSite test in CI. @@ -346,6 +349,7 @@ jobs: composer self-update composer create-project --no-dev --ignore-platform-req=php acquia/orca ../orca "$ORCA_VERSION" -n curl https://gist.githubusercontent.com/rajeshreeputra/170586f217b422eb9cdfd9ca9457a2e3/raw/c2f277ba9005b91d7f662cacf37b3940a66a9b8c/sut-path-reposories.patch | git -C ../orca apply + composer config extra."drupal-scaffold".file-mapping {} --json -d ${ORCA_SUT_DIR} - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 with: From ac4202235c5df25c3fac57282e69ec17056d0928 Mon Sep 17 00:00:00 2001 From: Vishal Khode Date: Tue, 3 Dec 2024 01:33:37 +0530 Subject: [PATCH 3/5] ACMS-4239: Temp commit. --- .github/workflows/deployment.workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployment.workflow.yml b/.github/workflows/deployment.workflow.yml index 6faa617c2..bf84f941a 100644 --- a/.github/workflows/deployment.workflow.yml +++ b/.github/workflows/deployment.workflow.yml @@ -1,7 +1,7 @@ name: "Code Deployment on Acquia Environment" on: push: - branches: [ develop, main ] + branches: [ develop, main, ACMS-4329 ] jobs: acquia_code_deployment: if: ${{ github.event_name == 'push' }} From f9859bcee76b296bdf8a0f594196a78442597cf3 Mon Sep 17 00:00:00 2001 From: Vishal Khode Date: Wed, 4 Dec 2024 16:01:27 +0530 Subject: [PATCH 4/5] ACMS-4329: Remove Acquia Pipelines CD. --- acquia-pipelines.yml | 47 -------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 acquia-pipelines.yml diff --git a/acquia-pipelines.yml b/acquia-pipelines.yml deleted file mode 100644 index eb4063182..000000000 --- a/acquia-pipelines.yml +++ /dev/null @@ -1,47 +0,0 @@ -# This file is used by Acquia Pipelines continuous integration. Upon success, an -# artifact is deployed to the `orionacms` subscription on Acquia Cloud. -version: 1.3.0 -services: - - composer: - version: 2 - - php: - version: 8.3 - -events: - build: - steps: - - setup: - type: script - script: - - composer validate --no-check-all --ansi --no-interaction - - composer install - - mkdir -p docroot/modules/acquia_cms - # Create symlink directory for multisite headless and community. - - cd docroot/sites - - ln -s default headless - - ln -s default community - - cd - - - composer archive --format zip --file acquia_cms - - unzip acquia_cms.zip -d docroot/modules/acquia_cms - # Commenting as it's no longer needed and this is failing deployment. - # - front-end: - # type: script - # script: - # - cd docroot/themes/contrib/acquia_claro - # - npm install - # - npm run build - # - cd - - - cleanup: - type: script - script: - - rm acquia_cms.zip - # Prepare settings.php with the minimum required for Cloud. - - chmod -R +w docroot/sites/default - - cp docroot/sites/default/default.settings.php docroot/sites/default/settings.php - # Clear any config directories that Cloud tries to set in the include file. - - echo "\$config_directories = [];" >> docroot/sites/default/settings.php - # Use the existing `config` directory we already have. Cloud gets confused - # because we already have a config directory above docroot and manipulating it - # in Pipelines doesn't seem to work. This deployment is ephemeral, so using - # the existing config directory isn't a problem. - - echo "\$config_directories['sync'] = '../config';" >> docroot/sites/default/settings.php From e0acf49145747bae9467551b5eb8f94d9eb063d4 Mon Sep 17 00:00:00 2001 From: Vishal Khode Date: Wed, 4 Dec 2024 16:01:44 +0530 Subject: [PATCH 5/5] ACMS-4329: Minor improvements made. --- .github/workflows/deployment.workflow.yml | 48 +++++++++++++---------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/.github/workflows/deployment.workflow.yml b/.github/workflows/deployment.workflow.yml index bf84f941a..f9e4acf8e 100644 --- a/.github/workflows/deployment.workflow.yml +++ b/.github/workflows/deployment.workflow.yml @@ -2,23 +2,35 @@ name: "Code Deployment on Acquia Environment" on: push: branches: [ develop, main, ACMS-4329 ] + +concurrency: + group: "ci-${{ github.ref }}" + cancel-in-progress: true + +env: + GIT_AUTHOR_NAME: "CD" + GIT_COMMITTER_NAME: "CD" + GIT_COMMITTER_EMAIL: "no-reply@acquia.com" + GIT_AUTHOR_EMAIL: "no-reply@acquia.com" + PHP_VERSION: 8.3 + CORE_VERSION: ^11 + jobs: acquia_code_deployment: if: ${{ github.event_name == 'push' }} - name: "Code Deployment on Acquia Environment" - env: - GIT_AUTHOR_NAME: "Vishal Khode" - GIT_COMMITTER_NAME: "Vishal Khode" - GIT_COMMITTER_EMAIL: "vishal.khode@acquia.com" - GIT_AUTHOR_EMAIL: "vishal.khode@acquia.com" + name: "Code Deployment" runs-on: ubuntu-latest environment: acquia_code_deployment - concurrency: production + env: + ACQUIA_CLOUD_ENVIRONMENT: "dev" + ACQUIA_CLOUD_API_KEY: ${{ secrets.ACQUIA_CLOUD_API_KEY }} + ACQUIA_CLOUD_API_SECRET: ${{ secrets.ACQUIA_CLOUD_API_SECRET }} + ACQUIA_CLOUD_APPLICATION: ${{ secrets.ACQUIA_CLOUD_APPLICATION }} steps: - uses: actions/checkout@v4 - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: ${{ env.PHP_VERSION }} - name: Configure SSH keys run: | mkdir -p ~/.ssh @@ -64,9 +76,7 @@ jobs: ln -s default headless ln -s default community cd - - git add . && git commit -m "Update drupal core and it's dependencies." - env: - CORE_VERSION: ^11 + git add . && git commit -m "Update drupal core and it's dependencies." 2>/dev/null - name: Setup Acquia CLI run: | curl -OL https://github.com/acquia/cli/releases/latest/download/acli.phar @@ -75,26 +85,24 @@ jobs: acli --version acli auth:login --key=${ACQUIA_CLOUD_API_KEY} --secret=${ACQUIA_CLOUD_API_SECRET} -n + ACQUIA_APPLICATION_UUID=$(acli api:applications:find ${ACQUIA_CLOUD_APPLICATION} -n | jq -r '.uuid') acli link ${ACQUIA_APPLICATION_UUID} -n + acli remote:aliases:download -n - git add . && git commit -m "Added acli & drush alias configurations." - env: - ACQUIA_CLOUD_API_KEY: ${{ secrets.ACQUIA_CLOUD_API_KEY }} - ACQUIA_CLOUD_API_SECRET: ${{ secrets.ACQUIA_CLOUD_API_SECRET }} - ACQUIA_APPLICATION_UUID: ${{ secrets.ACQUIA_APPLICATION_UUID }} + git add . && git commit -m "Added acli & drush alias configurations." 2>/dev/null - name: Deploy & Switch Code shell: bash run: | BRANCH_TO_DEPLOY=acli-${GITHUB_REF_NAME} - acli push:artifact ${ACQUIA_CLOUD_ENVIRONMENT} --destination-git-branch=${BRANCH_TO_DEPLOY} -n + acli push:artifact ${ACQUIA_CLOUD_APPLICATION}.${ACQUIA_CLOUD_ENVIRONMENT} --destination-git-branch=${BRANCH_TO_DEPLOY} -n - DEPLOYED_BRANCH=$(acli api:environments:find ${ACQUIA_CLOUD_ENVIRONMENT} -n | jq -r '.vcs.path') + DEPLOYED_BRANCH=$(acli api:environments:find ${ACQUIA_CLOUD_APPLICATION}.${ACQUIA_CLOUD_ENVIRONMENT} -n | jq -r '.vcs.path') # If BRANCH_TO_DEPLOY is NOT the same as DEPLOYED_BRANCH. Then switch code. if [ "$BRANCH_TO_DEPLOY" != "$DEPLOYED_BRANCH" ]; then # Step 1: Run the code:switch command and capture its output. - response=$(acli api:environments:code-switch ${ACQUIA_CLOUD_ENVIRONMENT} ${BRANCH_TO_DEPLOY} -n) + response=$(acli api:environments:code-switch ${ACQUIA_CLOUD_APPLICATION}.${ACQUIA_CLOUD_ENVIRONMENT} ${BRANCH_TO_DEPLOY} -n) # Step 2: Extract the notification ID from the JSON response notification_id=$(echo "$response" | jq -r '.notification') @@ -138,5 +146,3 @@ jobs: sleep 5 done fi - env: - ACQUIA_CLOUD_ENVIRONMENT: ${{ secrets.ACQUIA_CLOUD_ENVIRONMENT }}