|
| 1 | +#!/bin/bash -xe |
| 2 | + |
| 3 | +BETA_VERSION=${1:?Missing Beta Version, Use 2}; shift |
| 4 | +SHORT_VERSION=${1:?Missing Short Version, Use 2.4.99.2}; shift |
| 5 | +STRANGE_VERSION=${1:?Missing Strange Version, Use '2.5 beta2'}; shift |
| 6 | +HTML_VERSION=${1:?Missing HTML Version, Use '25-beta-2'}; shift |
| 7 | +WIN32_VERSION=${1:?Missing Win32 Version, Use '2.5-beta2'}; shift |
| 8 | +ARCHIVE_VERSION=${1:?Missing Archive Version, Use '2.4.99.2' for ci or _VERSION_ARCHIVE_ for release}; shift |
| 9 | +CI_VERSION=${1:?Missing CI Version - Use 2.4.99.2+bla}; shift |
| 10 | +DATE=`date --date=${1:?ISO DATE or now} --iso-8601=seconds`; shift |
| 11 | +AUTHOR=${1:?Mail Address}; shift |
| 12 | +TEXT=${1:?Release Text}; shift |
| 13 | +ICECAST_PROJECT=${1:?Icecast OSC Project Name}; shift |
| 14 | +W32_ICECAST_PROJECT=${1:?Icecast W32 OSC Project Name}; shift |
| 15 | +W32_ICECAST_INSTALLER_PROJECT=${1:?Icecast W32 Installer OSC Project Name}; shift |
| 16 | + |
| 17 | +OSC_BASE_DIR=osc_tmp |
| 18 | + |
| 19 | +# upon release we modify the templates - in ci we modiy temporary files |
| 20 | +if [ "$ARCHIVE_VERSION" = "_VERSION_ARCHIVE_" ]; then |
| 21 | + OSC_BASE_DIR=ci/osc |
| 22 | +fi |
| 23 | + |
| 24 | +pushd $OSC_BASE_DIR |
| 25 | + |
| 26 | +sed -i "1s#^#icecast2 ($CI_VERSION-1) UNRELEASED; urgency=medium\n\n * $TEXT\n\n -- $AUTHOR `date --date=$DATE +"%a, %d %b %Y %H:%M:%S %z"`\n\n#" $ICECAST_PROJECT/debian/changelog |
| 27 | + |
| 28 | +for i in "$ICECAST_PROJECT/$ICECAST_PROJECT.spec" "$W32_ICECAST_INSTALLER_PROJECT/$W32_ICECAST_INSTALLER_PROJECT.spec" "$W32_ICECAST_PROJECT/$W32_ICECAST_PROJECT.spec"; do |
| 29 | + sed -i "s/_VERSION_ARCHIVE_/$ARCHIVE_VERSION/; s/^Version:\(\s*\)[^\s]*$/Version:\1$CI_VERSION/; s#^%changelog.*\$#\0\n* `date --date=$DATE +"%a %b %d %Y"` $AUTHOR - $CI_VERSION-1\n- $TEXT\n\n#" "$i"; |
| 30 | +done |
| 31 | + |
| 32 | +sed -i "s/\(icecast_win32_\).*\(.exe\)/\1$WIN32_VERSION\2/" $W32_ICECAST_INSTALLER_PROJECT/$W32_ICECAST_INSTALLER_PROJECT.spec |
| 33 | + |
| 34 | +popd |
| 35 | + |
| 36 | +# we only update the changelog for releases - until i figure out if we want to run the magic script pre CI |
| 37 | +if [ "$ARCHIVE_VERSION" = "_VERSION_ARCHIVE_" ]; then |
| 38 | + sed -i "1s#^#`date --date=$DATE +"%Y-%m-%d %H:%M:%S"` $AUTHOR\n\n * $TEXT\n\n#" ChangeLog |
| 39 | +fi |
| 40 | + |
| 41 | +sed -i "1s#\[[.0-9]*\]#[$SHORT_VERSION]#" configure.ac |
| 42 | + |
| 43 | +sed -i "s/Icecast .* Documentation/Icecast $STRANGE_VERSION Documentation/; s/icecast-.*-documentation/icecast-$HTML_VERSION-documentation/" doc/index.html |
| 44 | + |
| 45 | +sed -i "s/\(\"DisplayVersion\" \"\).*\(\"\)$/\1$STRANGE_VERSION\2/" win32/icecast.nsis |
| 46 | +sed -i "s/\(OutFile \"icecast_win32_\).*\(.exe\"\)$/\1$WIN32_VERSION\2/" win32/icecast.nsis |
| 47 | + |
| 48 | +sed -i "s/^\(export ICECAST_VERSION=\).*$/\1$SHORT_VERSION/; s/\(export ICECAST_BETA_VERSION=\).*$/\1$BETA_VERSION/" ci/osc/*-config.sh |
| 49 | + |
| 50 | +# we only do this for release builds |
| 51 | +if [ "$ARCHIVE_VERSION" = "_VERSION_ARCHIVE_" ]; then |
| 52 | + sed -i "s/^\(export RELEASE_AUTHOR=\"\).*\(\"\)$/\1$AUTHOR\2/; s/\(export RELEASE_DATETIME=\).*$/\1$DATE/" ci/osc/release-config.sh |
| 53 | +fi |
| 54 | + |
| 55 | +if [ "$ARCHIVE_VERSION" != "_VERSION_ARCHIVE_" ]; then |
| 56 | + if ! git diff --quiet; then |
| 57 | + echo "git detected differences after ci driven create changelog run, this should not happen - please check"; |
| 58 | + git status |
| 59 | + git --no-pager diff |
| 60 | + exit 1; |
| 61 | + else |
| 62 | + echo "no repo diffs detected, this is good as CI should not change the repo(only temp files)!" |
| 63 | + fi |
| 64 | +else |
| 65 | + echo "applied changes to versions, please verify and commit them for a new release" |
| 66 | + git status |
| 67 | + git --no-pager diff |
| 68 | +fi |
0 commit comments