Skip to main content

Experience Management

Deploying Sling CMS Apps with GitHub Actions

Github Actions Banner

I use Apache Sling CMS for my personal site, so I can easily author my blog posts from nearly anywhere. Unfortunately, since this is a personal site, I’m not exactly spending the dollars on building out a full Continuous Integration / Delivery process.

Enter GitHub Actions

GitHub provides Actions, a free for limited use solution for executing code on Git repository events. With GitHub Actions, I can set up a pipeline to automatically deploy my code on changes to the master branch.

Actions Pipeline Definition

The pipeline is defined as a YAML file, deploy.yaml, under the directory .github.workflows in my code repository.

# Deploys code updates to my personal site on push to the master branch

name: Deploy on Push
      - master
    runs-on: ubuntu-latest
    - uses: actions/[email protected]
    - name: Set up JDK 1.8
      uses: actions/[email protected]
        java-version: 1.8
        server-id: github
        settings-path: ${{ github.workspace }}
    - name: Build and Deploy
      run: mvn install -B -s $GITHUB_WORKSPACE/settings.xml -PautoInstallBundle,ci
        SLING_HOST: ${{ secrets.DEPLOY_HOST }}
        SLING_USERNAME: ${{ secrets.DEPLOY_USERNAME }}
        SLING_PASSWORD: ${{ secrets.DEPLOY_PASSWORD }}
        SLING_PROTOCOL: https
        SLING_PORT: 443 

A few things to note about the pipeline definition:

  • The definition on object contains my invocation definition, in this case, pushes to master
  • In the Maven command, I’ve added a custom profile ci, this profile will copy the environment variables seen in the env object
  • The env parameter to Build and Deploy contains the parameters, including secret parameters for deploying the code

Keeping Secrets, Secret

In order to deploy my code, I have to provide the CMS authoring URL and the username / password for an Administrative user. Naturally, I don’t want to put this information on the web. With GitHub Actions, I can create secrets within the project:

Configure GitHub Action Instances

And then use the ci profile in the POM to copy those secrets as environment variables from the env parameter in the Github Actions pipeline into the Maven project properties.


Once this is all wired up, you can push in a small change to execute the pipeline and you should see the deployment succeed. Note that the secrets are hidden from the logs so even if a user can see the pipeline, they cannot see the secret values.

Execution Result from GitHub Actions

With Github Actions, you can not only host a small Apache Sling CMS website for free, but you can even have a reliable CI/CD process!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Dan Klco, Adobe Digital Marketing Technical Director

Dan is a certified Adobe Digital Marketing Technologist, Architect, and Advisor, having led multiple successful digital marketing programs on the Adobe Experience Cloud. He's passionate about solving complex problems and building innovative digital marketing solutions. Dan is a PMC Member of the Apache Sling project, frequent Adobe Beta participant and committer to ACS AEM Commons, allowing a unique insight into the cutting edge of the Adobe Experience Cloud platform.

More from this Author

Follow Us