-
Notifications
You must be signed in to change notification settings - Fork 3
feat(scripts): adds scripts for managing releases #81
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
Open
MStreet3
wants to merge
1
commit into
main
Choose a base branch
from
street_addsReleaseScripts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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
File renamed without changes.
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 |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| ### Release Process | ||
|
|
||
| Releases are created from a candidate branch. Create a candidate branch by running: | ||
|
|
||
| ```bash | ||
| $ make init_release | ||
| ``` | ||
|
|
||
| Follow the prompts. | ||
|
|
||
| Once the release is ready to be tagged execute the publish flow: | ||
|
|
||
| ```bash | ||
| $ make publish_release | ||
| ``` | ||
|
|
||
| Follow the prompts to tag either a `beta` pre-release set of tags or a `stable` tag without a pre-release suffix. | ||
|
|
||
| The following packages will be tagged: | ||
| - generator/protoc-gen-cre | ||
| - capabilities/scheduler/cron | ||
| - capabilities/networking/http | ||
| - capabilities/blockchain/evm | ||
|
Comment on lines
+21
to
+23
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. Can we discover capabilities by walking the folders? |
||
|
|
||
| Merge and delete the release branch once tags are accepted and verified. | ||
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 |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| #!/bin/bash | ||
|
|
||
| source ./print.sh | ||
|
|
||
| describe "Fixing release branch" | ||
| read -p "Release Version (X.Y.Z): " version | ||
|
|
||
| if [[ ! $version =~ ^[0-9]+.[0-9]+.[0-9]+$ ]] | ||
| then | ||
| error "Release version must be in semantic versioning format (X.Y.Z)" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Get the cherry-pick commit hash | ||
| read -p "Enter the commit hash to cherry pick: " commitHash | ||
|
|
||
| git show $commitHash | ||
|
|
||
| current_branch=$(git rev-parse --abbrev-ref HEAD) | ||
| release_branch="release/v$version" | ||
| fix_branch="fix/v$version/$commitHash" | ||
|
|
||
| # Check that the branch exists | ||
| describe "Checking remote origin for release branch..." | ||
| if git ls-remote --exit-code --heads origin $release_branch > /dev/null; then | ||
| echo "Found release branch" | ||
| else | ||
| error "Failed to find release branch" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Checkout the release branch | ||
| describe "Updating remote tracking branches..." | ||
| git fetch origin | ||
|
|
||
| # Create a new branch from the release branch | ||
| describe "Creating fix branch..." | ||
| git checkout -B $fix_branch origin/$release_branch | ||
|
Comment on lines
+36
to
+38
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. Is this what we want? It seems wrong to make releases from the non-main branch. |
||
|
|
||
| # Cherry pick the commit | ||
| describe "Cherry picking commit onto fix branch..." | ||
| if git cherry-pick -S $commitHash > /dev/null; then | ||
| echo "Cherry pick successful" | ||
| else | ||
| error "Failed to cherry pick commit. Rolling back..." | ||
|
|
||
| git cherry-pick --abort | ||
| git checkout $current_branch | ||
| git branch -D $fix_branch | ||
|
|
||
| exit 1 | ||
| fi | ||
|
|
||
| # Push the fix branch | ||
| describe "Pushing fix branch to origin..." | ||
| git push origin $fix_branch | ||
|
|
||
| # Create a pull request | ||
| describe "Creating pull request to merge fix branch into release branch..." | ||
| gh pr create --fill --base $release_branch --head $fix_branch --label "release-fix" | ||
|
|
||
| # Reset the branch back to the user's current branch | ||
| describe "Reset local branch back to original branch..." | ||
| git checkout $current_branch | ||
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 |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| source ./print.sh | ||
|
|
||
| # Fetches remote branches from origin | ||
| function fetch_remote_branches() { | ||
| # Update remote tracking branches | ||
| describe "Updating remote tracking branches..." | ||
| git fetch origin | ||
| } | ||
|
|
||
| # Verify that the branch exists | ||
| function verify_remote_release_branch() { | ||
| release_branch=$1 | ||
|
|
||
| describe "Checking remote origin for release branch..." | ||
| if git ls-remote --exit-code --heads origin $release_branch > /dev/null; then | ||
| echo "Found release branch" | ||
| else | ||
| error "Failed to find release branch" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| function ask_version { | ||
| question=$1 | ||
|
|
||
| read -p "$question " version | ||
|
|
||
| if [[ ! $version =~ ^[0-9]+.[0-9]+.[0-9]+$ ]] | ||
| then | ||
| echo "Failed to give a proper semver version number, exiting" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo $version | ||
| } |
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 |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Initializes a new release branch from the trunk branch | ||
|
|
||
| readonly TRUNK_BRANCH="main" | ||
|
|
||
| source ./print.sh | ||
| source ./helpers.sh | ||
|
|
||
| # accept a version from the user | ||
| describe "Initializing a new release branch..." | ||
| read -p "Release Version (X.Y.Z): " version | ||
|
|
||
| if [[ ! $version =~ ^[0-9]+.[0-9]+.[0-9]+$ ]] | ||
| then | ||
| error "Release version must be in semantic versioning format (X.Y.Z)" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Ensure we don't have any tags which match the provided version | ||
| describe "Checking for existing tags..." | ||
| if git ls-remote --tags origin | grep -q "v$version"; then | ||
| error "A tag for v$version already exists. Please use a different version number" | ||
| exit 1 | ||
| fi | ||
|
|
||
| current_branch=$(git rev-parse --abbrev-ref HEAD) | ||
| release_branch="release/v$version" | ||
| remote_trunk_branch="origin/$TRUNK_BRANCH" | ||
|
|
||
| # Define the target branch for the release. By default we use the remote trunk, but if the hotfix | ||
| # flag is provided, we prompt for a tag to base the release on. | ||
| release_target=$remote_trunk_branch | ||
| while [[ $# -gt 0 ]]; do | ||
| case "$1" in | ||
| --hotfix) | ||
| describe "Hotfix flag detected. Please provide a tag to base the release on" | ||
| read -p "Tag: " tag | ||
| release_target="tags/v$tag" | ||
|
|
||
| describe "Fetching all remote tags" | ||
| git fetch --all --tags | ||
| ;; | ||
| esac | ||
| shift | ||
| done | ||
|
|
||
| # Update remote tracking branches | ||
| fetch_remote_branches | ||
|
|
||
| # Create a release branch from the tip of the remote main branch | ||
| describe "Creating $release_branch targeting $release_target..." | ||
| git checkout -b $release_branch $release_target | ||
| if [ $? -ne 0 ]; then | ||
| error "Failed to create release branch $release_branch" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Push the release branch to origin | ||
| describe "Pushing $release_branch to origin..." | ||
| git push -u origin $release_branch | ||
| if [ $? -ne 0 ]; then | ||
| error "Failed to publish $release_branch. Rolling back..." | ||
|
|
||
| git checkout $current_branch; | ||
| git branch -D $release_branch; | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Reset the branch back to the user's current branch | ||
| describe "Reset local branch back to original branch..." | ||
| git checkout $current_branch | ||
|
|
||
| describe "Successfully initialized $release_branch!" |
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 |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Echos the given string in green | ||
| function describe { | ||
| echo -e "\033[0;32m$1\033[0m" | ||
| } | ||
|
|
||
| # Echos the given string in red | ||
| function error { | ||
| echo -e "\033[0;31m$1\033[0m" | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
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.
It's unlikely we'll always keep the capabilities in sync with the base SDK.