From 4a1d829675096dac6f56e3fc5c7cc1718035f333 Mon Sep 17 00:00:00 2001 From: Vishal Khode Date: Wed, 4 Dec 2024 16:13:45 +0530 Subject: [PATCH] More mimor improvements made. --- .github/workflows/deployment.workflow.yml | 25 +++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deployment.workflow.yml b/.github/workflows/deployment.workflow.yml index 226bc2ab8..e1c9a3564 100644 --- a/.github/workflows/deployment.workflow.yml +++ b/.github/workflows/deployment.workflow.yml @@ -22,6 +22,17 @@ jobs: runs-on: ubuntu-latest environment: acquia_code_deployment concurrency: production + env: + ACQUIA_CLOUD_ENVIRONMENT: ${{ matrix.environment }} + 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 }} + ACQUIA_CLOUD_APPLICATION: ${{ secrets.ACQUIA_CLOUD_APPLICATION }} + strategy: + fail-fast: false + matrix: + environment: + - dev steps: - uses: actions/checkout@v4 - uses: shivammathur/setup-php@v2 @@ -81,26 +92,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 }} - 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') @@ -144,5 +153,3 @@ jobs: sleep 5 done fi - env: - ACQUIA_CLOUD_ENVIRONMENT: ${{ secrets.ACQUIA_CLOUD_ENVIRONMENT }}