Skip to Content
Technical Articles
Author's profile photo Pierre Dominique

DevOps: CAP CI/CD with GitHub Actions

This post will show you how to get started with GitHub Actions to build & deploy a CAP application on SCP Cloud Foundry.

GitHub Actions

There are many different solutions to implement Continuous Integration and Continuous Delivery/Deployment for CAP applications. You could use Azure DevOps (nice series from Jhodel Cailan), the new CI/CD Service on SCP or Project Piper for instance. However if you already use GitHub, GitHub Actions might be a good solution as everything is integrated and it’s very easy to get started.


  • SAP Business Application Studio or Visual Studio Code
  • SAP Cloud Platform Account
  • GitHub Account

Initial Setup

Before you can use GitHub Actions, you need a basic CAP application. You can follow the instructions below to create the app or just clone my repository. I won’t go into the details in this post as the CAP documentation was updated recently and will help you understand every step.

Create a New CAP Project

So first create a new CAP project with some sample code and check everything works properly with cds watch:

cds init cap-github-actions --add samples
cds watch


Enhance Project Configuration for SAP HANA Cloud

In order to deploy the application to SCP CF later, you need to modify the package.json file to add the configuration for SAP HANA (Cloud) :

  "cds": {
    "requires": {
      "db": {
        "kind": "sql"
    "hana": {
      "deploy-format": "hdbtable"

and add the hdb driver for SAP HANA as a dependency to the project:

npm add hdb --save


Build and Deploy from your local machine

Before using GitHub Actions to build and deploy the application, you can do it locally to check everything is fine.

Add the MTA deployment descriptor file (mta.yaml)

In order to deploy using MTA you need to add an mta.yaml file:

cds add mta


Build the MTA

Then the Cloud MTA Build Tool can be used to build the MTA:

npm install -g mbt
mbt build -p cf


Deploy the MTA to Cloud Foundry

Finally the MTA can be deployed to SCP CF:

cf login
cf deploy mta_archives/cap-github-actions_1.0.0.mtar


Build and Deploy Using GitHub Actions

Now that you a simple CAP app and you can build and deploy it from a local machine, let’s see how to do the same with GitHub Actions.

Encrypted Secrets

As you don’t want to expose the details of your Cloud Foundry account (organization, space and so on) you first need to create some encrypted secrets in GitHub. This can be done in the repository Settings on GitHub:

Create GitHub Workflow

Now you need to create a GitHub Workflow to build and deploy the project to Cloud Foundry when an event occurs (i.e push to master branch for instance). You don’t have to build everything from scratch and you can just reuse an existing action to deploy to CF.

To create a new Workflow, just click on the Actions tab and then on the setup a workflow yourself link:

This will open an editor where we can define our own workflow. Replace the content of the editor with the following code:

# Build Multitarget Application & Deploy it to Cloud Foundry
name: Build MTA & Deploy it to CF

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
    branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
    runs-on: ubuntu-latest
    - uses: actions/checkout@v2
    - name: Use Node.js
      uses: actions/setup-node@v1
        node-version: 12
    - name: Install MTA Build Tool
      run: npm install -g mbt
    # Do not generate package-lock.json
    # See
    - name: Disable package-lock.json
      run: npm config set package-lock false
    - name: Build MTA
      run: mbt build -p cf
    - name: Upload Artifact
      uses: actions/upload-artifact@master	
        name: mta
        path: ./mta_archives/cap-github-actions_1.0.0.mtar
     needs: build
     runs-on: ubuntu-latest
       - name: Download Artifact
         uses: actions/download-artifact@master
           name: mta
           path: ./
       - name: Deploy to Cloud Foundry
         uses: guerric-p/cf-cli-action@master
           cf_api: ${{ secrets.CF_API }}
           cf_username: ${{ secrets.CF_USERNAME }}
           cf_password: ${{ secrets.CF_PASSWORD }}
           cf_org: ${{ secrets.CF_ORG }}
           cf_space: ${{ secrets.CF_SPACE }}
           command: deploy ./cap-github-actions_1.0.0.mtar -f

This simple workflow contains 2 jobs, one to build the app and one to deploy the MTA to CF. There are multiple steps in each job to replicate everything you did locally using the GitHub infrastructure when code is pushed to the master branch.


There’s a temporary fix in the workflow to prevent EINTEGRITY errors. I believe this is due to the fact that SCP has not switched yet to the public npm repository (please read the following post from DJ Adams).

Test the Workflow

Now you just need to push to the master branch to trigger the new workflow and to automatically build & deploy the application.

You should see the status of the workflow on GitHub:

and you can also navigate to the details:


This post just gives you the basics to get started, there are many things you can do with GitHub Actions:

  • trigger workflow with various events: push, issue creation, pull request creation etc.
  • use your own self-hosted runners if the provided runners don’t meet your needs
  • re-use workflows and actions provided by the community

If you have any experience with GitHub Actions or other CI/CD solutions please do share your thoughts!

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo DJ Adams
      DJ Adams

      Nice one Pierre - this is definitely going on my reading list!

      Author's profile photo Christoph Szymanski
      Christoph Szymanski

      Good read Pierre, short question: would you like to use piper if it could run in the context of GH actions?

      (Disclaimer: I'm Product Owner for some of the project "Piper" scenarios and the SAP Cloud Platform CI CD Service)



      Author's profile photo Pierre Dominique
      Pierre Dominique
      Blog Post Author

      Hi Christoph,

      It could be an option and AFAIK there is already a GH action for Piper ( We are currently evaluating GitHub and this is why I did a quick test with GH actions but I'd like to try other solutions (Azure DevOps, SCP CI/CD service, Piper etc.). Having everything integrated in GitHub is pretty nice.

      What we are looking for is an easy to use CI/CD solution because we are not an IT company and don't have a lot of developers and we can't spend too much time setting up and configuring our pipelines. And SCP is only one of our platforms so we need a solution which is compatible with other platforms and frameworks.

      Author's profile photo Dirk Raschke
      Dirk Raschke

      Hi Christoph,

      is there also a sample with GH actions for an on-premise XSA scenario (node.js)?




      Author's profile photo Gregor Wolf
      Gregor Wolf

      Hi Dirk,

      you can check out my sample .github/workflows/build-mta-hana.yml for a HANA XSA build and deploy.

      Best Regards

      Author's profile photo Simon Karolus
      Simon Karolus

      Hi Christoph,


      Is it currently possible to use a deploy step of project-piper (like cloudFoundryDeploy) with GH actions? As far as I can see, a credentialsId is needed instead of username and password which can be stored in the secrets in GH.



      Author's profile photo Gregor Wolf
      Gregor Wolf

      Hi Christoph Szymanski,

      I also try to get the project-piper command cloudFoundryDeploy working with the action "SAP/project-piper-action@master". I've added this to .github/workflows/build-mta-cf.yml but I run into the same issue as described in cloudFoundryDeploy is successful even though deployment was skipped #2184.

      Looking forward for your input.

      Best Regards

      Author's profile photo Jhodel Cailan
      Jhodel Cailan

      Thanks for the mention and this excellent blog Pierre Dominique !

      I will definitely try hands-on on this one, it looks interesting!

      Author's profile photo Prabuddha Raj
      Prabuddha Raj

      HI Pierre,
      Can we also use this for SAP Hana Native application projects in BTP?

      Author's profile photo Prabuddha Raj
      Prabuddha Raj

      i am getting the below error, i think i need to download cf cli plugin through github actions for this to work.

      Not logged in. Use 'cf login' or 'cf login --sso' to log in.
      16API endpoint: ***
      18{"error":"invalid_grant","error_description":"User authentication failed: Unauthorized"}
      Author's profile photo Prabuddha Raj
      Prabuddha Raj

      hi All and @martin,
      i have found the solution for this problem. you need to login to cloud foundry through script in the file. i have forked the repo and added that code. you can use it from here

      Author's profile photo Alessandro Spadoni
      Alessandro Spadoni

      Hi Pierre,

      thanks for your interesting blog, I have 2 questions:

      • the temporary fix is already needed? As for my understanding it deletes the package-lock.json and we could have some issues removing locked dependencies
      • is there a way to have dynamic version? e.g. cap-github-actions_x.y.z.mtar​