Skip to content

SAP Commerce Cloud - Build

This GitHub Action provides the following functionalities to perform build operations on SAP Commerce Cloud in the Public Cloud (CCv2) projects.

Project Status

🚀 Completed Items

  • Trigger Build: Trigger SAP Commerce Cloud build.
  • Build Notification: Sends a notification when a build is triggered in CCv2.
  • Build Status Notification: Frequently check the build status and send notifications when success or failure.
  • Retry On Failure: Retry the build creation if it fails for the maxRetries times.
  • Notifications: Notify the user via email or webhook when the build is triggered or completed.
    • Create Build: Triggered with build is created in CCv2.
    • Build Completed: Triggered when the build is completed in CCv2 whether it is success or failure.
    • Slack: Send notifications to Slack.
    • Microsoft Teams: Send notifications to Microsoft Teams.

🔧 Planned Items

  • Testing: Improve test coverage with end-to-end tests.
  • Notifications: Notify the user via email or webhook when the build is triggered or completed.
    • Email: Send notifications to email.
    • SendGrid: Send notifications using SendGrid.
    • AWS SES: Send notifications using AWS SES.
    • Custom SMTP: Send notifications using custom SMTP.
    • Similar SMTP services.

Getting Started

Check this GitHub Action on the GitHub Marketplace

Example Workflow

Create a workflow YAML file (e.g., .github/workflows/build.yml) in your repository with the following content:

.github/workflows/build.yml
1
name: Build SAP Commerce Cloud
2
3
on:
4
push:
5
branches:
6
- 'release/*'
7
8
jobs:
9
test-build-action:
10
name: GitHub Actions Test
11
runs-on: ubuntu-latest
12
13
env:
14
SAP_CCV2_API_TOKEN: ${{ secrets.SAP_CCV2_API_TOKEN }}
15
SAP_CCV2_SUB_CODE: ${{ secrets.SAP_CCV2_SUB_CODE }}
16
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
17
18
steps:
19
- name: Checkout
20
id: checkout
21
uses: actions/checkout@v4
22
23
- name: SAP Commerce Build
24
id: build-action
25
uses: sap-cx-actions/commerce-build@v1
26
with:
27
branch: release/v1.0.0
28
buildName: Release v1.0.0
29
checkStatusInterval: 60000
30
retryOnFailure: true
31
maxRetries: 3
32
notify: true
33
dryRun: true
34
35
- name: Print Output
36
id: output
37
run: |
38
echo "Build Code: ${{ steps.build-action.outputs.buildCode }}, Build Status: ${{ steps.build-action.outputs.buildStatus }}"

Environment Variables

VariablePurposeRequired
SAP_CCV2_API_TOKENSAP Commerce Cloud in the Public Cloud (CCv2) API Token.True
SAP_CCV2_SUB_CODESAP Commerce Cloud in the Public Cloud (CCv2) Subscription CodeTrue
WEBHOOK_URLThe Webhook URL to send notifications.False

Inputs

AttributePurposeRequiredDefaultExample
branchThe branch name or tag to trigger the build.Truerelease/v1.0.0
buildNameThe name of the build.False
checkStatusIntervalThe interval in milliseconds to check the build status.False300000 (5 minutes)
retryOnFailureRetry the build if failed.Falsefalse
maxRetriesThe maximum number of retries.False3
notifySend notifications on the build status.Falsefalse
dryRunRun the action in dry-run mode. If true, the action will not trigger the build in actual CCv2.Falsefalse

Outputs

  • buildCode - The build code of the triggered build.
  • buildStatus - The status of the triggered build.