-
Notifications
You must be signed in to change notification settings - Fork 196
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
Add Action to setup release candidate branch #4204
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we still need this if the previous step will exit with failure There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions
also works, to avoid polluting the env vars |
||
run: | | ||
git checkout -b $releaseBranch | ||
git push --set-upstream origin $releaseBranch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we default this to the current HEAD of main