Skip to content

Commit

Permalink
More mimor improvements made.
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalkhode1 committed Dec 4, 2024
1 parent 18dcf79 commit 4a1d829
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/deployment.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -144,5 +153,3 @@ jobs:
sleep 5
done
fi
env:
ACQUIA_CLOUD_ENVIRONMENT: ${{ secrets.ACQUIA_CLOUD_ENVIRONMENT }}

0 comments on commit 4a1d829

Please sign in to comment.