๐ Automating Drupal Deployments to Acquia with GitHub Actions
Managing a Drupal site on Acquia? Automate deployments and Drush commands with GitHub Actions for faster, safer releases.
๐ Automating Drupal Deployments to Acquia with GitHub Actions

If youโre managing a Drupal site hosted on Acquia Cloud Platform, manual deployments and Drush commands can slow you down and introduce risk.
In this article, Iโll walk you through setting up a production-grade GitHub Actions workflow that deploys to Acquia automatically when a pull request to main is closed (and merged), or when manually triggered.
โ Why Use GitHub Actions for Acquia?
- Fully automated deployments to Acquia Cloud environments (
dev,test,prod) - Composer install, Drush commands, and config import in one pipeline
- Safe SSH setup and Acquia CLI usage
- Clear separation of environments with optional manual dispatch
- Bonus: Get notifications in Google Chat or Slack after deployment (optional)
๐ง Prerequisites
To make this work, youโll need:
- An Acquia Cloud Site (with SSH access enabled)
- A GitHub repository that holds your Drupal project
- Public part of your SSH key must be added to Acquia via Cloud > Git > SSH Keys
- Repository variables named
ACQUIA_SITE(e.g. drupalsite) andACQUIA_GIT_HOST(e.g svn.prod.hosting.acquia.com) - The following GitHub Secrets added to your repo:
ACQUIA_API_KEY_IDโ Your Acquia API Key IDACQUIA_API_KEY_SECRETโ Your Acquia API Key SecretACQUIA_SSH_PRIVATE_KEYโ Private SSH key that has access to your Acquia Cloud Git repo- Public part of your SSH key must be added to Acquia via Cloud > Git > SSH Keys
๐ ๏ธ The GitHub Actions Workflow
Hereโs the full YAML workflow, saved as .github/workflows/deploy.yml:
name: Deploy to Acquia
on:
pull_request:
branches: [main]
types: [closed]
workflow_dispatch:
inputs:
environment:
description: "Environment"
required: true
type: choice
options: [dev, test, prod]
default: test
env:
ACQUIA_SITE: ${{ vars.ACQUIA_SITE }}
ACQUIA_GIT_HOST: ${{ vars.ACQUIA_GIT_HOST }}
ACQUIA_CLI_NO_INTERACTION: 1
jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ inputs.environment || 'test' }}
steps:
- name: Skip if not merged PR or manual trigger
if: github.event_name == 'pull_request' && github.event.pull_request.merged == false
run: exit 0
- name: Set ENV vars
run: |
echo "ENVIRONMENT=${{ inputs.environment || 'test' }}" >> $GITHUB_ENV
echo "BRANCH_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Block non-main to prod
if: env.ENVIRONMENT == 'prod' && env.BRANCH_NAME != 'main'
run: exit 1
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer
extensions: mbstring, pdo, xml, gd, curl, zip, bcmath, intl
- name: Install Composer Dependencies
run: composer install --no-dev --optimize-autoloader
- name: Install Acquia CLI
run: |
curl -sSL https://github.com/acquia/cli/releases/latest/download/acli.phar -o acli
chmod +x acli && sudo mv acli /usr/local/bin/acli
- name: Setup SSH key for Acquia Git
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.ACQUIA_SSH_PRIVATE_KEY }}
- name: Add Acquia host to known_hosts
run: ssh-keyscan -H ${{ env.ACQUIA_GIT_HOST }} >> ~/.ssh/known_hosts
- name: Set Git author info for Acquia commit
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "githubactions@salmanhaider.com"
- name: Authenticate & Deploy to Acquia
run: |
acli auth:login --key=${{ secrets.ACQUIA_API_KEY_ID }} --secret=${{ secrets.ACQUIA_API_KEY_SECRET }}
acli push:artifact $ACQUIA_SITE.$ENVIRONMENT --no-interaction
acli remote:drush $ACQUIA_SITE.$ENVIRONMENT -- deploy -y || true

๐ฏ GitHub Actions UI allowing manual execution by branch and target environment.

โ Successful deployment log showing artifact push and post-deploy Drush commands on Acquia.
๐ก Benefits of This Setup
- Clean & readable GitHub workflow
- Handles Composer install + config import
- Git commit author set (avoids identity errors)
- SSH securely handled using
webfactory/ssh-agent - Production protection โ prevents accidental deploys from non-main branches
- Can easily be extended for tag-based deploys, Slack/Chat notifications, or previews
๐ Final Thoughts
If youโre deploying to Acquia Cloud and want reproducible, safe, and automated deploys โ this GitHub Actions workflow will save your team a ton of time. It enforces best practices, reduces human error, and gets you closer to CI/CD bliss ๐
Got ideas to enhance or optimize this workflow? Letโs collaborate โ comment below or connect directly!
๋ฉํ๋ฐ์ดํฐ
- post_id
- 7567a9f8341d
- slug
- automating-drupal-deployments-to-acquia-with-github-actions-7567a9f8341d
- url
- https://medium.com/@isalmanhaider/automating-drupal-deployments-to-acquia-with-github-actions-7567a9f8341d
- canonical_url
- https://medium.com/@isalmanhaider/automating-drupal-deployments-to-acquia-with-github-actions-7567a9f8341d
- author_url
- https://medium.com/@isalmanhaider
- status
- ok
- fetched_at
- 2026-07-20 06:08:36