Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add Pre-release action to synchronize branches #804

Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/workflows/synchronize-branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Release to CDN and Synchronize Branches
alexs-mparticle marked this conversation as resolved.
Show resolved Hide resolved

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick - The term dryRun and the description isn't accurate here. Nothing is happening in the dryRun == true path, which I get is intentional - I'm being nitpicky about the variable name itself (and description). I'm not sure I have a better input here besides asking "Are you sure?" in this case.

Suggested change
dryRun:
description: 'Do a dry run to preview instead of a real release [true/false]'
required: true
type: boolean
default: true
dryRun:
description: 'Type in false to push a specific version of the mParticle Web SDK to all branches'
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# As a safe guard, if a valid release branch does not exist,
# this step will fail and throw an error
# As a safe guard, if a valid release branch does not exist,
# 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:
ref: release/${{ github.event.inputs.versionNumber}}


synchronize-sdk:
alexs-mparticle marked this conversation as resolved.
Show resolved Hide resolved
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: [email protected]
GIT_COMMITTER_NAME: mparticle-automation
GIT_COMMITTER_EMAIL: [email protected]

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 == 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
git push origin HEAD:release-order-c
Loading