-
Notifications
You must be signed in to change notification settings - Fork 136
Add make-official-release script #1524
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
Merged
Merged
Changes from 2 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
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
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 |
|---|---|---|
|
|
@@ -34,25 +34,120 @@ | |
|
|
||
| set -e | ||
|
|
||
| # Log a line to sterr and exit with error code 1 | ||
| err() { | ||
| echo "ERROR: $1" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| if [ $# -eq 0 ]; then | ||
| read -r -p "Please enter the wanted version number (example: 4.12.1): " version | ||
| echo "" | ||
| if [ -z "${version}" ]; then | ||
| echo "Please enter a valid version number" | ||
| exit 1 | ||
| # TODO SEMVER REGEX? | ||
| err "Please enter a valid version number next time." | ||
| fi | ||
| else | ||
| version=$1 | ||
| fi | ||
|
|
||
| if [ $# -lt 2 ]; then | ||
| read -r -p "Please enter the increment number [by default: 00]: " incr | ||
| if [ -z "${incr}" ]; then | ||
| incr="00" | ||
| fi | ||
| else | ||
| incr=$2 | ||
| fi | ||
|
|
||
| current_branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') | ||
| date=$(date "+%Y%m%d") | ||
| dev_branch="release/v${version}-dev.${date}${incr}" | ||
| canal_branch="release/v${version}-canal.${date}${incr}" | ||
| dev_version="${version}-dev.${date}${incr}" | ||
| canal_version="${version}-canal.${date}${incr}" | ||
| dev_branch="release/v${dev_version}" | ||
| canal_branch="release/v${canal_version}" | ||
|
|
||
| if [ -n "$(git status --porcelain doc)" ]; then | ||
| echo "ERROR: Please commit your modifications to \"${current_branch}\" first" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "This script will create the dev versions: $dev_version and $canal_version" | ||
|
|
||
| echo "checking that the branches do not already exist locally or remotely..." | ||
| if ! [ -z $(git branch --list "$dev_branch") ]; then | ||
| err "Branch name "$dev_branch" already exists locally. Please delete it first." | ||
Florent-Bouisset marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| fi | ||
| if ! [ -z $(git branch --list "$canal_branch") ]; then | ||
| err "Branch name "canal_branch" already exists locally. Please delete it first." | ||
| fi | ||
| if ! [ -z $(git ls-remote --heads [email protected]:canalplus/rx-player.git "refs/heads/$dev_branch") ]; then | ||
| err "Branch name "$dev_branch" already exists remotely. Please delete it first." | ||
| fi | ||
| if ! [ -z $(git ls-remote --heads [email protected]:canalplus/rx-player.git "refs/heads/$canal_branch") ]; then | ||
| err "Branch name "$canal_branch" already exists remotely. Please delete it first." | ||
| fi | ||
|
|
||
| echo "checking that the versions are not already published on npm..." | ||
| if npm view rx-player@$dev_version >/dev/null 2>&1; then | ||
| err "Version already published to npm: $version-dev.${date}${incr}" | ||
| fi | ||
|
|
||
| if npm view rx-player@$canal_version >/dev/null 2>&1; then | ||
| err "Version already published to npm: $version-canal.${date}${incr}" | ||
| fi | ||
|
|
||
| # Make dev Changelog | ||
| npm run releases:changelog -- $dev_version -d | ||
|
|
||
| $EDITOR CHANGELOG.md | ||
|
|
||
| if [ -n "$(git status --porcelain CHANGELOG.md)" ]; then | ||
| echo "-- Current CHANGELOG.md Status: --" | ||
| echo "" | ||
| git status CHANGELOG.md | ||
|
|
||
| while :; do | ||
| echo "" | ||
| echo "We will push this CHANGELOG.md update to ${current_branch}." | ||
| read -p "do you want to continue [y/d/s/a/c/t/h] (h for help) ? " -n1 REPLY | ||
| echo "" | ||
|
|
||
| if [[ $REPLY =~ ^[Hh](elp)?$ ]]; then | ||
| echo "" | ||
| echo "" | ||
| echo "+- help -------------------------------------------------+" | ||
| echo "| y: commit and continue |" | ||
| echo "| d: see diff |" | ||
| echo "| s: see status |" | ||
| echo "| a: abort script from here |" | ||
| echo "| c: skip CHANGELOG.md update and go to the next step |" | ||
| echo "| h: see this help |" | ||
| echo "+--------------------------------------------------------+" | ||
| elif [[ $REPLY =~ ^[Yy](es)?$ ]]; then | ||
| git add CHANGELOG.md | ||
| git commit -m "Update CHANGELOG.md for v$dev_version" | ||
| git push [email protected]:canalplus/rx-player.git $current_branch | ||
| break | ||
| elif [[ $REPLY =~ ^[Dd](iff)?$ ]]; then | ||
| git diff CHANGELOG.md || true # ignore when return 1 | ||
| elif [[ $REPLY =~ ^[Ss](tatus)?$ ]]; then | ||
| git status CHANGELOG.md | ||
| elif [[ $REPLY =~ ^[Aa](bort)?$ ]]; then | ||
| echo "exiting" | ||
| exit 0 | ||
| elif [[ $REPLY =~ ^[Cc](heckout)?$ ]]; then | ||
| git checkout CHANGELOG.md | ||
| else | ||
| echo "invalid input" | ||
| fi | ||
| done | ||
| fi | ||
|
|
||
| if [ -n "$(git status --porcelain doc)" ]; then | ||
| echo "ERROR: Unexpected diff in \"${current_branch}\"" | ||
| exit 1 | ||
| fi | ||
|
|
||
| git checkout -b ${dev_branch} | ||
| ./scripts/update-version $version-dev.${date}${incr} | ||
|
|
@@ -62,9 +157,9 @@ while true; do | |
| read -n1 -p "Do you wish to push and publish the dev build? [y/n] " yn | ||
| echo "" | ||
| case $yn in | ||
| [Yy]* ) break;; | ||
| [Nn]* ) exit;; | ||
| * ) echo "Please answer y or n.";; | ||
| [Yy]*) break ;; | ||
| [Nn]*) exit ;; | ||
| *) echo "Please answer y or n." ;; | ||
| esac | ||
| done | ||
| git push origin ${dev_branch} | ||
|
|
@@ -82,9 +177,9 @@ while true; do | |
| read -n1 -p "Do you wish to push and publish the canal build? [y/n] " yn | ||
| echo "" | ||
| case $yn in | ||
| [Yy]* ) break;; | ||
| [Nn]* ) exit;; | ||
| * ) echo "Please answer y or n.";; | ||
| [Yy]*) break ;; | ||
| [Nn]*) exit ;; | ||
| *) echo "Please answer y or n." ;; | ||
| esac | ||
| done | ||
| npm publish --tag canal-v4 | ||
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.
Uh oh!
There was an error while loading. Please reload this page.