Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gomodtidy: gomods

.PHONY: install-protoc
install-protoc:
script/install-protoc.sh 29.3 /
scripts/install-protoc.sh 29.3 /
go install google.golang.org/protobuf/cmd/protoc-gen-go@`go list -m -json google.golang.org/protobuf | jq -r .Version`
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1

Expand Down Expand Up @@ -87,3 +87,12 @@ standard_tests:
( cd $$mod_dir/pkg/workflows/wasm/host && go test -c -o $$abs_dir/host.test . ); \
echo "Running standard tests"; \
$$abs_dir/host.test -test.v -test.run ^TestStandard -path=standard_tests


.PHONY: init_release
init_release:
cd ./scripts/release && bash init.sh

.PHONE: publish_release
publish_release:
cd ./scripts/release && bash publish.sh
File renamed without changes.
25 changes: 25 additions & 0 deletions scripts/release/README.md
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
Copy link
Contributor

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.

```

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

Choose a reason for hiding this comment

The 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.
64 changes: 64 additions & 0 deletions scripts/release/fix_release.sh
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
Copy link
Contributor

Choose a reason for hiding this comment

The 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
35 changes: 35 additions & 0 deletions scripts/release/helpers.sh
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
}
74 changes: 74 additions & 0 deletions scripts/release/init.sh
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!"
9 changes: 9 additions & 0 deletions scripts/release/print.sh
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"
}
Loading
Loading