update-version 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/env sh
  2. # Jellyfin.Versioning/update-version
  3. # Part of the Jellyfin project (https://jellyfin.media)
  4. #
  5. # All copyright belongs to the Jellyfin contributors; a full list can
  6. # be found in the file CONTRIBUTORS.md
  7. #
  8. # This program is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation, either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. if [ -d "$(dirname "$0")/../.git" ]; then
  21. commit=`git rev-parse HEAD`
  22. count=`git rev-list HEAD --count`
  23. branch=`git rev-parse --abbrev-ref HEAD`
  24. desc=`git describe --tags --always --long`
  25. remote=`git config --get remote.origin.url`
  26. tee jellyfin_version.ini <<EOF
  27. commit=$commit
  28. revision=$count
  29. branch=$branch
  30. tagdesc=$desc
  31. remote=$remote
  32. EOF
  33. cat <<EOF
  34. Updated build version in jellyfin_version.ini
  35. commit=$commit
  36. revision=$count
  37. branch=$branch
  38. tagdesc=$desc
  39. remote=$remote
  40. EOF
  41. else
  42. echo Did not update build version because there was no .git directory.
  43. fi