-
Notifications
You must be signed in to change notification settings - Fork 32
Upmerge fix #1649
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
Merged
willdavsmith
merged 7 commits into
radius-project:v0.36
from
brooke-hamilton:upmerge-fix
Aug 9, 2024
Merged
Upmerge fix #1649
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c7f9238
Fix error when no branch changes
brooke-hamilton c270a31
Remove extra commit
brooke-hamilton 99c6867
Merge pull request #1 from brooke-hamilton/upmerge-fix
brooke-hamilton fb887fc
Add comments
brooke-hamilton 9404f57
Fix branch name env var
brooke-hamilton c78ef3c
Clarify comments
brooke-hamilton f5444b8
Add example
brooke-hamilton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,27 @@ | ||
| # This workflow automates the process of upmerging changes from the current release branch to the edge branch. | ||
| # During the course of a release, the release branch is the default branch so that PRs can be immediately | ||
| # brought into the release without waiting for a new release. This workflow merges those changes into | ||
| # the edge branch so that edge can be used as the basis for the next release branch. | ||
| # | ||
| # This workflow assumes that it is being triggered from the current release branch, but it could be triggered from | ||
| # any branch, and it uses that branch as the source branch for merging into the edge branch. | ||
| # The workflow is triggered manually via the workflow_dispatch event. | ||
| # | ||
| # The workflow performs the following steps: | ||
| # 1. Checks out the edge branch. | ||
| # 2. Configures git with a user name and email. | ||
brooke-hamilton marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # 3. Creates a new branch from edge. | ||
| # 4. Merges changes from the branch executing the workflow into the edge branch created in the previous step. | ||
| # 5. Pushes the new branch if there are changes. | ||
| # 6. Creates a pull request to merge the new branch into edge. | ||
|
|
||
| # Example: | ||
| # The current release branch is v0.36. We are creating the new release for v0.37. | ||
| # The release person manually triggers this workflow from branch v0.36. The workflow runs, which does the following | ||
| # 1. A new branch is created named upmerge/2024-07-31-98b9. The source branch is edge. | ||
| # 2. Changes from branch v0.36 are merged into branch upmerge/2024-07-31-98b9. | ||
| # 3. A PR is created from branch upmerge/2024-07-31-98b9 --> edge. The workflow finishes and reports success. | ||
|
|
||
| name: Upmerge samples to edge | ||
|
|
||
| on: | ||
|
|
@@ -8,30 +32,49 @@ jobs: | |
| name: Upmerge samples to edge | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
|
|
||
| # Check out the edge branch | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: edge | ||
| # https://github.com/actions/checkout/issues/125#issuecomment-570254411 | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Configure git | ||
| run: | | ||
| git config --global user.email "radiuscoreteam@service.microsoft.com" | ||
| git config --global user.name "Radius CI Bot" | ||
| - name: Create new branch | ||
|
|
||
| # Create a new branch from edge. This branch will be used to PR back into edge. | ||
| - name: Create new branch from edge | ||
| run: | | ||
| export DATE=$(date +%Y-%m-%d) | ||
| export RAND=$(openssl rand -hex 2) | ||
| echo "BRANCH_NAME=upmerge/$DATE-$RAND" >> $GITHUB_ENV | ||
| git checkout -b upmerge/$DATE-$RAND | ||
| export BRANCH_NAME=upmerge/$DATE-$RAND | ||
| echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | ||
| git checkout -b $BRANCH_NAME | ||
|
|
||
| # Merge changes from the github.ref branch, i.e., the branch from which the workflow is triggered. That | ||
| # branch is assumed to be the current release branch, but could be any branch. | ||
| # If there are no changes, stop the workflow. | ||
| - name: Upmerge samples | ||
| run: | | ||
| export SOURCE_BRANCH=$(basename ${{ github.ref }}) | ||
| echo "Upmerging samples from $SOURCE_BRANCH to edge" | ||
| git fetch origin $SOURCE_BRANCH | ||
| git merge --no-commit origin/$SOURCE_BRANCH | ||
| git commit -m "Upmerge to edge" | ||
| git push --set-upstream origin $BRANCH_NAME | ||
| git merge -m "Upmerge to edge" origin/$SOURCE_BRANCH | ||
|
|
||
| if git diff --quiet edge; then | ||
| echo "No changes to merge from $SOURCE_BRANCH to edge" | ||
| echo "NO_CHANGES=true" >> $GITHUB_ENV | ||
| else | ||
| echo "Pushing $BRANCH_NAME for PR to edge" | ||
| git push --set-upstream origin $BRANCH_NAME | ||
| fi | ||
brooke-hamilton marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Create a PR from the new branch to edge | ||
| - name: Create pull request | ||
| if: env.NO_CHANGES != 'true' | ||
|
Contributor
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. we should also update the release process doc to inform that there might not be a PR created: https://github.com/radius-project/radius/tree/main/docs/contributing/contributing-releases |
||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GH_RAD_CI_BOT_PAT}} | ||
| run: gh pr create --title "Upmerge to edge" --body "Upmerge to edge (kicked off by @${{ github.triggering_actor }})" --base edge --head $BRANCH_NAME | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.