AEM Cloud Service - Github Actions Workflow to Sync Code from Github Repo to Adobe Cloud Manager Git Repo


To simplify the Cloud Manager Pipeline & Build process, following is a sample Github Actions Workflow to do a Code Sync on push to main branch, from an External Customer Managed Git Repo to Adobe Cloud Manager Git Repo


1) Add the Cloud Manger Git Repo Creds ADOBE_GIT_USERNAME and ADOBE_GIT_PASSWORD in https://github.com/<owner>/<repo>/settings/secrets/actions


2) Add the workflow in <repo>\.github\workflows\sync-to-adobe-cm.yml and push to main/master branch

name: Sync to Adobe Cloud Manager

on:
  push:
    branches:
      - main
      - master
      - develop

jobs:
  sync:
    runs-on: ubuntu-latest
   
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
     
      - name: Configure Git
        run: |
          git config --global user.name "GitHub Actions"
          git config --global user.email "actions@github.com"
     
      - name: Add Adobe Cloud Manager remote
        run: |
          git remote add adobe https://git.cloudmanager.adobe.com/acsaem/SreekanthChoudryNalabotu-p10961/
     
      - name: Push to Adobe Cloud Manager
        env:
          ADOBE_GIT_USERNAME: ${{ secrets.ADOBE_GIT_USERNAME }}
          ADOBE_GIT_PASSWORD: ${{ secrets.ADOBE_GIT_PASSWORD }}
        run: |
          git push https://${ADOBE_GIT_USERNAME}:${ADOBE_GIT_PASSWORD}@git.cloudmanager.adobe.com/acsaem/SreekanthChoudryNalabotu-p10961/ HEAD:main --force


3) On Push to main branch the workflow is executed and Code is Synced to Adobe Git Repo, check the execution in https://github.com/<owner>/<repo>/actions






No comments:

Post a Comment