From 9d6eb814c9c4ca1cfc26b8e69c7ae2d78ed9d603 Mon Sep 17 00:00:00 2001 From: Manodnya Jaydeep Bhoite Date: Sat, 23 Mar 2024 11:43:05 -0700 Subject: [PATCH] Add Action to setup release branch --- .github/workflows/setupReleaseBranch.yml | 46 ++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/setupReleaseBranch.yml diff --git a/.github/workflows/setupReleaseBranch.yml b/.github/workflows/setupReleaseBranch.yml new file mode 100644 index 0000000000..dd0af3be9f --- /dev/null +++ b/.github/workflows/setupReleaseBranch.yml @@ -0,0 +1,46 @@ +name: Set up a new Release Candidate + +on: + workflow_dispatch: + inputs: + commitId: + description: "Commit Id" + default: "" + required: true + type: string + versionNumber: + description: "Version number/name" + default: "" + required: true + type: string + +jobs: + setupReleaseCandidateBranch: + name: Setup a release candidate branch + runs-on: ubuntu-latest + env: + releaseBranchPattern: "release/candidate/*" + steps: + - name: Sync code + uses: actions/checkout@v4 + with: + ref: ${{ inputs.commitId }} + + - name: Check if remote branch exists + run: | + if git ls-remote --exit-code --heads origin $releaseBranchPattern; then + echo "EXISTS=true" >> $GITHUB_ENV + echo "Release candidate branch already exists" + exit 1 + else + echo "EXISTS=false" >> $GITHUB_ENV + echo "Release candidate branch does not exist" + fi + + - name: Set up release branch + env: + releaseBranch: "release/candidate/${{inputs.versionNumber}}" + if: ${{ env.EXISTS == 'false' }} + run: | + git checkout -b $releaseBranch + git push --set-upstream origin $releaseBranch