]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - scripts/release.sh
Add comments in nginx regarding blocks that can be safely removed
[github/Chocobozzz/PeerTube.git] / scripts / release.sh
index 8c73a1fd61b7dbbabbbfa4c1d5f8c1195d1c3e56..ef6399b68a2ff6690892d6842d9909be49d84f06 100755 (executable)
@@ -25,12 +25,18 @@ if [ -z "$GITHUB_TOKEN" ]; then
 fi
 
 branch=$(git symbolic-ref --short -q HEAD)
-if [ "$branch" != "develop" ]; then
-  echo "Need to be on develop branch."
+if [ "$branch" != "develop" ] && [[ "$branch" != feature/* ]]; then
+  echo "Need to be on develop or release branch."
   exit -1
 fi
 
 version="v$1"
+github_prerelease_option=""
+if [[ "$version" = *".pre."* ]]; then
+  echo "This is a pre-release."
+  github_prerelease_option="--pre-release"
+fi
+
 directory_name="peertube-$version"
 zip_name="peertube-$version.zip"
 tar_name="peertube-$version.tar.xz"
@@ -41,8 +47,7 @@ printf "Changelog will be:\\n%s\\n" "$changelog"
 
 read -p "Are you sure to release? " -n 1 -r
 echo
-if [[ ! $REPLY =~ ^[Yy]$ ]]
-then
+if [[ ! $REPLY =~ ^[Yy]$ ]]; then
   exit 0
 fi
 
@@ -57,7 +62,8 @@ git commit package.json client/package.json -m "Bumped to version $version"
 git tag -s -a "$version" -m "$version"
 
 npm run build
-rm "./client/dist/stats.json"
+rm "./client/dist/en_US/stats.json"
+rm "./client/dist/embed-stats.json"
 
 # Creating the archives
 (
@@ -89,17 +95,25 @@ rm "./client/dist/stats.json"
 (
   git push origin --tag
 
-  github-release release --user chocobozzz --repo peertube --tag "$version" --name "$version" --description "$changelog"
+  if [ -z "$github_prerelease_option" ]; then
+    github-release release --user chocobozzz --repo peertube --tag "$version" --name "$version" --description "$changelog"
+  else
+    github-release release --user chocobozzz --repo peertube --tag "$version" --name "$version" --description "$changelog" "$github_prerelease_option"
+  fi
+
   github-release upload --user chocobozzz --repo peertube --tag "$version" --name "$zip_name" --file "$zip_name"
   github-release upload --user chocobozzz --repo peertube --tag "$version" --name "$zip_name.asc" --file "$zip_name.asc"
   github-release upload --user chocobozzz --repo peertube --tag "$version" --name "$tar_name" --file "$tar_name"
   github-release upload --user chocobozzz --repo peertube --tag "$version" --name "$tar_name.asc" --file "$tar_name.asc"
 
-  git push origin develop
+  git push origin "$branch"
 
-  # Update master branch
-  git checkout master
-  git rebase develop
-  git push origin master
-  git checkout develop
+  # Only update master if it is not a pre release
+  if [ -z "$github_prerelease_option" ]; then
+      # Update master branch
+      git checkout master
+      git merge "$branch"
+      git push origin master
+      git checkout "$branch"
+  fi
 )