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 77e559c
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions .github/workflows/deployment.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,26 @@ env:
jobs:
acquia_code_deployment:
if: ${{ github.event_name == 'push' }}
name: "Code Deployment on Acquia Environment"
name: "Code Deployment"
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
- stage
- prod
- next
- ode7
- ode8
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -72,7 +88,7 @@ jobs:
ln -s default headless
ln -s default community
cd -
git add . && git commit -m "Update drupal core and it's dependencies."
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
Expand All @@ -81,26 +97,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')
Expand Down Expand Up @@ -144,5 +158,3 @@ jobs:
sleep 5
done
fi
env:
ACQUIA_CLOUD_ENVIRONMENT: ${{ secrets.ACQUIA_CLOUD_ENVIRONMENT }}

0 comments on commit 77e559c

Please sign in to comment.