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

Add script that generates commands for our releases #5913

Closed
wants to merge 1 commit into from

Conversation

biboudis
Copy link
Contributor

@biboudis biboudis commented Feb 13, 2019

This small script, currently, it just generates the necessary commands according to our release. For now it gets the latest release from the list of tags not ending in RCXX. In the future it may be used to fully automate our release process.

Sample output for the current release #5907:

cd /dotty
git checkout 0.12.x
sed -i '' 's/^\([[:blank:]]*\)val baseVersion = "0.12.0-RC1".*/\1val baseVersion = "0.12.0"/' project/Build.scala
git commit -am 'Release Dotty 0.12.0'
git tag 0.12.0
git push --follow-tags --set-upstream origin 0.12
git checkout master
git merge 0.12.x
git push
git checkout -b 0.13.x
sed -i '' 's/^\([[:blank:]]*\)val baseVersion = "0.12.0".*/\1val baseVersion = "0.13.0-RC1"/' project/Build.scala
git commit -am 'Release Dotty 0.13.0-RC1'
git tag 0.13.0-RC1
git push --follow-tags --set-upstream origin 0.13.x
git checkout master
sed -i '' 's/^\([[:blank:]]*\)val baseVersion = "0.13.0".*/\1val baseVersion = "0.14.0"/' project/Build.scala
git commit -am 'Set baseVersion to 0.14.0'
git push

@biboudis biboudis added the itype:meta Issues about process/similar label Feb 13, 2019
@biboudis biboudis self-assigned this Feb 13, 2019
@abgruszecki
Copy link
Contributor

@biboudis if you want to write reasonably resilient shellscripts you might be interested in https://github.com/AleksanderBG/bashutil/blob/master/try.sh. It defines a try function that you use like this:

try mkdir "$dir"
try touch "$dir/file"

try first prints the command being run, attempts to run it and exits if the command returns false. It's way easier to understand what when wrong when you use sth like this.

@abgruszecki
Copy link
Contributor

Oh, I forgot to add this: set -e can sometimes be really surprising, that's why it can be preferable to use something like try: https://mywiki.wooledge.org/BashFAQ/105

Copy link
Contributor

@allanrenucci allanrenucci left a comment

Choose a reason for hiding this comment

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

I am not convinced by this PR. People publishing and pushing directly to master should know what git commands they are running and what they do. This script suggests that you can just run the script, copy paste the output in your terminal and you're good to go.

On the other hand, I think it would be great to document theses step somewhere. Not sure a script that prints the steps is the best format though

#!/usr/bin/env bash

# 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.


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 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 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

@@ -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


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

@biboudis
Copy link
Contributor Author

biboudis commented Feb 13, 2019

@allanrenucci This was meant to be an auto-generated script towards some level of automation instead of the complete manual way now.

@AleksanderBG At this step all commands are echos, for mere manual execution. Not need for resilience at this point.

@biboudis biboudis closed this Feb 13, 2019
@biboudis biboudis deleted the make-release-script branch February 13, 2019 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
itype:meta Issues about process/similar
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants