Skip to content

Add script that generates commands for our releases #5913

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

Closed
wants to merge 1 commit into from
Closed
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
70 changes: 70 additions & 0 deletions project/scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script should not assume that origin is lampepfl/dotty


# Usage:
# RELEASE_DIR=<directory to place fresh clones of projects> ./release.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What it this RELEASE_DIR. Why not assume this is ran from within the dotty repo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I wanted a fresh cloned copy with default remotes etc.


set -e

# TODO: clone all the projects
# cd $RELEASE_DIR
# [email protected]:lampepfl/dotty
# git clone [email protected]:lampepfl/dotty-example-project.git
# git clone --single-branch --branch mill [email protected]:lampepfl/dotty-example-project.git
# git clone [email protected]:lampepfl/dotty.g8.git
# git clone [email protected]:lampepfl/dotty-cross.g8.git
# git clone [email protected]:lampepfl/homebrew-brew.git
# git clone [email protected]:lampepfl/packtest.git
# git clone [email protected]:scalacenter/scastie/.git

# Parsing latest release from the list of tags not ending in RCX
version=($(git tag --list '*.0' --sort=v:refname | tail -n1 | tr '.' '\n'))

major=${version[0]}
minor=${version[1]}
build=${version[2]}

LAST_RELEASE="$major.$minor"

RELEASE="$major.$((minor+1))"

RC_RELEASE="0.$((minor+2))"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've been releasing 0.x stable and 0.(x + 1)-RC1 at the same time but there is no reason it should always be the case


V_NEXT="0.$((minor+3))"

echo "cd $RELEASE_DIR/dotty"

echo "git checkout $RELEASE.x"

echo "sed -i '' 's/^\([[:blank:]]*\)val baseVersion = \"$RELEASE.0-RC1\".*/\1val baseVersion = \"$RELEASE.0\"/' project/Build.scala"

echo "git commit -am 'Release Dotty $RELEASE.0'"

echo "git tag $RELEASE.0"

echo "git push --follow-tags --set-upstream origin $RELEASE"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why --set-upstream?


echo "git checkout master"

echo "git merge $RELEASE.x"

echo "git push"

echo "git checkout -b $RC_RELEASE.x"

echo "sed -i '' 's/^\([[:blank:]]*\)val baseVersion = \"$RELEASE.0\".*/\1val baseVersion = \"$RC_RELEASE.0-RC1\"/' project/Build.scala"

echo "git commit -am 'Release Dotty $RC_RELEASE.0-RC1'"

echo "git tag $RC_RELEASE.0-RC1"

echo "git push --follow-tags --set-upstream origin $RC_RELEASE.x"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why --set-upstream?


echo "git checkout master"

echo "sed -i '' 's/^\([[:blank:]]*\)val baseVersion = \"$RC_RELEASE.0\".*/\1val baseVersion = \"$V_NEXT.0\"/' project/Build.scala"

echo "git commit -am 'Set baseVersion to $V_NEXT.0'"

echo "git push"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git push origin master. I am wondering if the default pushes all branches. If think it is better to be specific, specially when you're pushing to master


# TODO: perform all the version bumps, commit, push and create the PRs