bump_version 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/env bash
  2. # bump_version - increase the shared version and generate changelogs
  3. set -o errexit
  4. set -o pipefail
  5. set -o xtrace
  6. usage() {
  7. echo -e "bump_version - increase the shared version"
  8. echo -e ""
  9. echo -e "Usage:"
  10. echo -e " $ bump_version <new_version>"
  11. }
  12. if [[ -z $1 ]]; then
  13. usage
  14. exit 1
  15. fi
  16. shared_version_file="./SharedVersion.cs"
  17. # csproj files for nuget packages
  18. jellyfin_subprojects=(
  19. MediaBrowser.Common/MediaBrowser.Common.csproj
  20. Jellyfin.Data/Jellyfin.Data.csproj
  21. MediaBrowser.Controller/MediaBrowser.Controller.csproj
  22. MediaBrowser.Model/MediaBrowser.Model.csproj
  23. Emby.Naming/Emby.Naming.csproj
  24. src/Jellyfin.Extensions/Jellyfin.Extensions.csproj
  25. )
  26. issue_template_file="./.github/ISSUE_TEMPLATE/issue report.yml"
  27. new_version="$1"
  28. new_version_sed="$( cut -f1 -d'-' <<<"${new_version}" )"
  29. old_version="$(
  30. grep "AssemblyVersion" ${shared_version_file} \
  31. | sed -E 's/\[assembly: ?AssemblyVersion\("([0-9\.]+)"\)\]/\1/'
  32. )"
  33. echo old assembly version: $old_version
  34. # Set the assembly version to the specified new_version
  35. sed -i "s|${old_version}|${new_version_sed}|g" ${shared_version_file}
  36. # update nuget package version
  37. for subproject in ${jellyfin_subprojects[@]}; do
  38. echo ${subproject}
  39. # Parse the version from the *.csproj file
  40. old_version="$(
  41. grep "VersionPrefix" ${subproject} \
  42. | awk '{$1=$1};1' \
  43. | sed -E 's/<VersionPrefix>([0-9\.]+[-a-z0-9]*)<\/VersionPrefix>/\1/'
  44. )"
  45. echo old nuget version: $old_version
  46. # Set the nuget version to the specified new_version
  47. sed -i "s|${old_version}|${new_version_sed}|g" ${subproject}
  48. done
  49. # Set the version in the GitHub issue template file
  50. sed -i "s|${old_version}|${new_version_sed}|g" ${issue_template_file}
  51. # Stage the changed files for commit
  52. git add .
  53. git status -v