From 7a4c0785a2b8e01c8d6034751c5a7f5a93c9158e Mon Sep 17 00:00:00 2001 From: Alexander Sapountzis Date: Mon, 20 Nov 2023 13:12:16 -0500 Subject: [PATCH 1/7] ci: Add Pre-release action to synchronize branches --- .github/workflows/synchronize-branches.yml | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/synchronize-branches.yml diff --git a/.github/workflows/synchronize-branches.yml b/.github/workflows/synchronize-branches.yml new file mode 100644 index 00000000..caf6df6c --- /dev/null +++ b/.github/workflows/synchronize-branches.yml @@ -0,0 +1,77 @@ +name: Release to CDN and Synchronize Branches + +on: + workflow_dispatch: + inputs: + dryRun: + description: 'Do a dry run to preview instead of a real release [true/false]' + required: true + type: boolean + default: true + versionNumber: + description: 'Which SDK version to syncronize? [X.XX.XX]' + required: true + type: string + +jobs: + verify-version-number: + name: Verify SDK Version (${{ github.event.inputs.versionNumber}}) + runs-on: ubuntu-latest + steps: + # As a safe guard, if a valid release branch does not exist, + # this step will fail and throw an error + - name: Checkout SDK Version (${{ github.event.inputs.versionNumber}}) + uses: actions/checkout@v3 + with: + ref: release/${{ github.event.inputs.versionNumber}} + + + synchronize-sdk: + name: Synchronize SDK to all branches + runs-on: ubuntu-latest + needs: + - verify-version-number + env: + GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} + GIT_AUTHOR_NAME: mparticle-automation + GIT_AUTHOR_EMAIL: developers@mparticle.com + GIT_COMMITTER_NAME: mparticle-automation + GIT_COMMITTER_EMAIL: developers@mparticle.com + + steps: + - name: Checkout master branch + uses: actions/checkout@v3 + with: + fetch-depth: 0 + repository: ${{ github.repository }} + token: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} + ref: master + + - name: Merge release branch into master branch + if: ${{ github.event.inputs.dryRun == 'false' }} + run: | + git pull origin release/${{ github.event.inputs.versionNumber}} + + # We will eventually replace master with main + - name: Push release commits to main and master + if: ${{ github.event.inputs.dryRun == 'false' }} + run: | + git push origin HEAD:master + git push origin HEAD:main + + - name: Push release commits to development + if: ${{ github.event.inputs.dryRun == 'false' }} + run: | + git push origin HEAD:development + + - name: Push release commits to chore/dependabot + if: ${{ github.event.inputs.dryRun }} + run: | + git push origin HEAD:chore/dependabot + + - name: Force Push release commits to Release Order Branches + if: ${{ github.event.inputs.dryRun }} + run: | + git push origin HEAD:release-order-a -f + git push origin HEAD:release-order-b -f + git push origin HEAD:release-order-b -f \ No newline at end of file From d7846e7ff209da0d963b5075be7d793450a45051 Mon Sep 17 00:00:00 2001 From: Alexander Sapountzis Date: Mon, 20 Nov 2023 15:26:23 -0500 Subject: [PATCH 2/7] Remove force push option --- .github/workflows/synchronize-branches.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/synchronize-branches.yml b/.github/workflows/synchronize-branches.yml index caf6df6c..141a684d 100644 --- a/.github/workflows/synchronize-branches.yml +++ b/.github/workflows/synchronize-branches.yml @@ -69,9 +69,9 @@ jobs: run: | git push origin HEAD:chore/dependabot - - name: Force Push release commits to Release Order Branches + - name: Push release commits to Release Order Branches if: ${{ github.event.inputs.dryRun }} run: | - git push origin HEAD:release-order-a -f - git push origin HEAD:release-order-b -f - git push origin HEAD:release-order-b -f \ No newline at end of file + git push origin HEAD:release-order-a + git push origin HEAD:release-order-b + git push origin HEAD:release-order-c \ No newline at end of file From 7d8c602ebda0a9f24cd9e5cbb922e94642129844 Mon Sep 17 00:00:00 2001 From: Alex S <49695018+alexs-mparticle@users.noreply.github.com> Date: Mon, 20 Nov 2023 15:54:01 -0500 Subject: [PATCH 3/7] Apply suggestions from code review --- .github/workflows/synchronize-branches.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/synchronize-branches.yml b/.github/workflows/synchronize-branches.yml index 141a684d..45dd58f6 100644 --- a/.github/workflows/synchronize-branches.yml +++ b/.github/workflows/synchronize-branches.yml @@ -48,29 +48,29 @@ jobs: ref: master - name: Merge release branch into master branch - if: ${{ github.event.inputs.dryRun == 'false' }} + if: ${{ github.event.inputs.dryRun == false }} run: | git pull origin release/${{ github.event.inputs.versionNumber}} # We will eventually replace master with main - name: Push release commits to main and master - if: ${{ github.event.inputs.dryRun == 'false' }} + if: ${{ github.event.inputs.dryRun == false }} run: | git push origin HEAD:master git push origin HEAD:main - name: Push release commits to development - if: ${{ github.event.inputs.dryRun == 'false' }} + if: ${{ github.event.inputs.dryRun == false }} run: | git push origin HEAD:development - name: Push release commits to chore/dependabot - if: ${{ github.event.inputs.dryRun }} + if: ${{ github.event.inputs.dryRun == false }} run: | git push origin HEAD:chore/dependabot - name: Push release commits to Release Order Branches - if: ${{ github.event.inputs.dryRun }} + if: ${{ github.event.inputs.dryRun == false }} run: | git push origin HEAD:release-order-a git push origin HEAD:release-order-b From 1786947e2ed051be9ec8719afaf5b9a6d1a0712b Mon Sep 17 00:00:00 2001 From: Alex S <49695018+alexs-mparticle@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:32:36 -0500 Subject: [PATCH 4/7] Update .github/workflows/synchronize-branches.yml Co-authored-by: Robert Ing --- .github/workflows/synchronize-branches.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/synchronize-branches.yml b/.github/workflows/synchronize-branches.yml index 45dd58f6..e274bfe3 100644 --- a/.github/workflows/synchronize-branches.yml +++ b/.github/workflows/synchronize-branches.yml @@ -1,4 +1,4 @@ -name: Release to CDN and Synchronize Branches +name: Release - Step 3: Release to CDN and Synchronize Branches on: workflow_dispatch: From 7a17504d4bb30772b51d783b805930b692aa478c Mon Sep 17 00:00:00 2001 From: Alexander Sapountzis Date: Tue, 21 Nov 2023 10:37:33 -0500 Subject: [PATCH 5/7] Address PR Comments --- .github/workflows/synchronize-branches.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/synchronize-branches.yml b/.github/workflows/synchronize-branches.yml index e274bfe3..be759c0a 100644 --- a/.github/workflows/synchronize-branches.yml +++ b/.github/workflows/synchronize-branches.yml @@ -3,11 +3,6 @@ name: Release - Step 3: Release to CDN and Synchronize Branches on: workflow_dispatch: inputs: - dryRun: - description: 'Do a dry run to preview instead of a real release [true/false]' - required: true - type: boolean - default: true versionNumber: description: 'Which SDK version to syncronize? [X.XX.XX]' required: true @@ -48,29 +43,24 @@ jobs: ref: master - name: Merge release branch into master branch - if: ${{ github.event.inputs.dryRun == false }} run: | git pull origin release/${{ github.event.inputs.versionNumber}} # We will eventually replace master with main - name: Push release commits to main and master - if: ${{ github.event.inputs.dryRun == false }} run: | git push origin HEAD:master git push origin HEAD:main - name: Push release commits to development - if: ${{ github.event.inputs.dryRun == false }} run: | git push origin HEAD:development - name: Push release commits to chore/dependabot - if: ${{ github.event.inputs.dryRun == false }} run: | git push origin HEAD:chore/dependabot - name: Push release commits to Release Order Branches - if: ${{ github.event.inputs.dryRun == false }} run: | git push origin HEAD:release-order-a git push origin HEAD:release-order-b From f1bfd789f811d0cb8ee63b65a4ab76d0e32f105e Mon Sep 17 00:00:00 2001 From: Alexander Sapountzis Date: Tue, 21 Nov 2023 10:38:27 -0500 Subject: [PATCH 6/7] Address PR Comments --- .github/workflows/synchronize-branches.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/synchronize-branches.yml b/.github/workflows/synchronize-branches.yml index be759c0a..1046f3ca 100644 --- a/.github/workflows/synchronize-branches.yml +++ b/.github/workflows/synchronize-branches.yml @@ -14,7 +14,9 @@ jobs: runs-on: ubuntu-latest steps: # As a safe guard, if a valid release branch does not exist, - # this step will fail and throw an error + # this step will fail and throw an error. + # Pushing previous versions of the SDK will require manual intervention. + # This action is not used for rollbacks. - name: Checkout SDK Version (${{ github.event.inputs.versionNumber}}) uses: actions/checkout@v3 with: From 2cdf40c9b7502d0a020e6f252607446d5b249db9 Mon Sep 17 00:00:00 2001 From: Alex S <49695018+alexs-mparticle@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:38:52 -0500 Subject: [PATCH 7/7] Update .github/workflows/synchronize-branches.yml Co-authored-by: Robert Ing --- .github/workflows/synchronize-branches.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/synchronize-branches.yml b/.github/workflows/synchronize-branches.yml index 1046f3ca..4a625c97 100644 --- a/.github/workflows/synchronize-branches.yml +++ b/.github/workflows/synchronize-branches.yml @@ -23,7 +23,7 @@ jobs: ref: release/${{ github.event.inputs.versionNumber}} - synchronize-sdk: + synchronize-branches: name: Synchronize SDK to all branches runs-on: ubuntu-latest needs: