diff --git a/.github/workflows/deployment.workflow.yml b/.github/workflows/deployment.workflow.yml index 226bc2ab8..554eaf717 100644 --- a/.github/workflows/deployment.workflow.yml +++ b/.github/workflows/deployment.workflow.yml @@ -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 @@ -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 @@ -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') @@ -144,5 +158,3 @@ jobs: sleep 5 done fi - env: - ACQUIA_CLOUD_ENVIRONMENT: ${{ secrets.ACQUIA_CLOUD_ENVIRONMENT }}