Skip to content
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

Setup bash script to facilitate experimenta releases #104

Merged
merged 2 commits into from
Sep 24, 2024
Merged
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
25 changes: 25 additions & 0 deletions setup-release-branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
pffigueiredo marked this conversation as resolved.
Show resolved Hide resolved
set -eux

# Generate a unique branch name using a timestamp
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
NEW_BRANCH="release-branch-$TIMESTAMP"

# Create an empty tree
git hash-object -t tree /dev/null

# Create a new commit with just the contents of dist/npm
new_commit=$(git commit-tree -m "Add npm distribution files" "$(git write-tree --prefix=dist/npm)")

# Create the new branch pointing to this commit
git update-ref "refs/heads/$NEW_BRANCH" "$new_commit"

# Push the new branch to the remote repository
git push origin "$NEW_BRANCH"

set +x
echo "New branch '$NEW_BRANCH' has been created and pushed with the contents of /dist/npm"
echo "----------------------------"
echo "Install this branch using:"
echo "npm install '@neondatabase/serverless'@'github:neondatabase/serverless#$NEW_BRANCH'"
set -x