1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

chore(build): adjust version updating script to not rely on git

Relying on git doesn't work in awful lot of cases, e.g. when there's a
shallow `git clone`.

Instead have "hardcoded" version in files, and update it before release.

Closes #4165.
This commit is contained in:
Zetok Zalbavar 2017-02-11 05:52:06 +00:00
parent 08fdb7561e
commit 63e95f3528
No known key found for this signature in database
GPG Key ID: C953D3880212068A
8 changed files with 89 additions and 73 deletions

View File

@ -162,6 +162,8 @@ process, so that no translation effort would be lost when resetting Weblate.**
- `PATCH` bump when there have been only fixes added. If changes include - `PATCH` bump when there have been only fixes added. If changes include
something more than just bugfixes, bump `MAJOR` or `MINOR` version something more than just bugfixes, bump `MAJOR` or `MINOR` version
accordingly. accordingly.
- update version for windows/osx packages using [`./tools/update-versions.sh`]
script
- before creating a `MAJOR`/`MINOR` release generate changelog with `clog`. - before creating a `MAJOR`/`MINOR` release generate changelog with `clog`.
- in a `MAJOR`/`MINOR` release tag should include information that changelog - in a `MAJOR`/`MINOR` release tag should include information that changelog
is located in the `CHANGELOG.md` file, e.g. `For details see CHANGELOG.md` is located in the `CHANGELOG.md` file, e.g. `For details see CHANGELOG.md`
@ -196,3 +198,4 @@ helping for a while, ask to be added to the `qTox` organization on GitHub.
[`test-pr.sh`]: /test-pr.sh [`test-pr.sh`]: /test-pr.sh
[`./tools/deweblate-translation-file.sh`]: /tools/deweblate-translation-file.sh [`./tools/deweblate-translation-file.sh`]: /tools/deweblate-translation-file.sh
[`./tools/create-tarball.sh`]: /tools/create-tarball.sh [`./tools/create-tarball.sh`]: /tools/create-tarball.sh
[`./tools/update-versions.sh`]: /tools/update-versions.sh

View File

@ -65,7 +65,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.7.0</string> <string>1.8.1</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>toxq</string> <string>toxq</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
@ -84,7 +84,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.7.0</string> <string>1.8.1</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>
<string>NSApplication</string> <string>NSApplication</string>
<key>UTImportedTypeDeclarations</key> <key>UTImportedTypeDeclarations</key>

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Copyright © 2016 The qTox Project Contributors # Copyright © 2016-2017 The qTox Project Contributors
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -16,30 +16,48 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# script to append correct qTox version to `.plist` file from # script to change qTox version in `info.plist` file to the supplied one
# `git describe`
# #
# NOTE: it checkouts the files before appending a version to them! # NOTE: it checkouts the files before appending a version to them!
# #
# requires: # requires:
# * correctly formatted `*.plist file(s) in working dir # * correctly formatted `info.plist file in working dir
# * git tags in format `v0.0.0`
# * GNU sed # * GNU sed
# usage: # usage:
# #
# ./$script # ./$script $version
#
# $version has to be composed of at least one number/dot
set -eu -o pipefail set -eu -o pipefail
# uses `get_version()` # update version in `info.plist` file to supplied one after the right lines
source "../tools/lib/git.source"
# append version to .plist file(s) after the right line
update_version() { update_version() {
local ver=$(get_version) local vars=(
defaults write "$(pwd)/info.plist" CFBundleVersion $ver ' <key>CFBundleShortVersionString</key>'
defaults write "$(pwd)/info.plist" CFBundleShortVersionString $ver ' <key>CFBundleVersion</key>'
plutil -convert xml1 info.plist )
for v in "${vars[@]}"
do
sed -i -r "\\R$v\$R,+1 s,(<string>)[0-9\\.]+(</string>)$,\\1$@\\2," \
"./info.plist"
done
} }
update_version
# exit if supplied arg is not a version
is_version() {
if [[ ! $@ =~ [0-9\\.]+ ]]
then
echo "Not a version: $@"
exit 1
fi
}
main() {
is_version "$@"
update_version "$@"
}
main "$@"

View File

@ -1,28 +0,0 @@
#!/bin/bash
#
# Copyright © 2016 The qTox Project Contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# source for scripts using git-based functionality
set -e -o pipefail
# Get numerical version from git tag, parts of version separated by dots
# from e.g. `v123.456.789` get `123.456.789` part
get_version() {
git describe --abbrev=0 \
| sed -e 's/^v//'
}

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Copyright © 2016 The qTox Project Contributors # Copyright © 2016-2017 The qTox Project Contributors
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -16,19 +16,20 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# script to add versions to the files for osx and windows "packages" # script to change versions in the files for osx and windows "packages"
# #
# it should be run by the `qTox-Mac-Deployer-ULTIMATE.sh` # it should be run before releasing a new version
# #
# NOTE: it checkouts the files before appending a version to them! # NOTE: it checkouts the files before appending a version to them!
# #
# requires: # requires:
# * git tags in format `v0.0.0`
# * GNU sed # * GNU sed
# usage: # usage:
# #
# ./$script # ./$script $version
#
# $version has to be composed of at least one number/dot
set -eu -o pipefail set -eu -o pipefail
@ -36,20 +37,34 @@ set -eu -o pipefail
update_windows() { update_windows() {
( cd windows ( cd windows
./qtox-nsi-version.sh ) ./qtox-nsi-version.sh "$@" )
} }
update_osx() { update_osx() {
( cd osx ( cd osx
./update-plist-version.sh ) ./update-plist-version.sh "$@" )
}
# exit if supplied arg is not a version
is_version() {
if [[ ! $@ =~ [0-9\\.]+ ]]
then
echo "Not a version: $@"
exit 1
fi
} }
main() { main() {
update_osx is_version "$@"
# osx cannot into proper sed # osx cannot into proper sed
if [[ ! "$OSTYPE" == "darwin"* ]] if [[ ! "$OSTYPE" == "darwin"* ]]
then then
update_windows update_osx "$@"
update_windows "$@"
else
# TODO: actually check whether there is a GNU sed on osx
echo "OSX's sed not supported. Get a proper one."
fi fi
} }
main main "$@"

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Copyright © 2016 Zetok Zalbavar <zetok@openmailbox.org> # Copyright © 2016-2017 Zetok Zalbavar <zetok@openmailbox.org>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -15,36 +15,42 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# script to append correct qTox version to `.nsi` files from
# `git describe` # script to change qTox version in `.nsi` files to supplied one
#
# NOTE: it checkouts the files before appending a version to them!
# #
# requires: # requires:
# * files `qtox.nsi` and `qtox64.nsi` in working dir # * files `qtox.nsi` and `qtox64.nsi` in working dir
# * git tags in format `v0.0.0`
# * GNU sed # * GNU sed
# usage: # usage:
# #
# ./$script # ./$script $version
#
# $version has to be composed of at least one number/dot
set -eu -o pipefail set -eu -o pipefail
# uses `get_version()`
source "../tools/lib/git.source"
# append version to .nsi files after a certain line
append_version() {
local after_line=' ${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "qTox"'
local append=' ${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion"'
# change version in .nsi files in the right line
change_version() {
for nsi in *.nsi for nsi in *.nsi
do do
git checkout "$nsi" sed -i -r "/DisplayVersion/ s/\"[0-9\\.]+\"$/\"$@\"/" "$nsi"
sed -i "/$after_line/a\\$append \"$(get_version)\"" "$nsi"
done done
} }
append_version # exit if supplied arg is not a version
is_version() {
if [[ ! $@ =~ [0-9\\.]+ ]]
then
echo "Not a version: $@"
exit 1
fi
}
main() {
is_version "$@"
change_version "$@"
}
main "$@"

View File

@ -281,6 +281,7 @@ Section "Install"
${WriteRegStr} "${REG_ROOT}" "${REG_APP_PATH}" "" "$INSTDIR\${MAIN_APP_EXE}" ${WriteRegStr} "${REG_ROOT}" "${REG_APP_PATH}" "" "$INSTDIR\${MAIN_APP_EXE}"
${WriteRegStr} "${REG_ROOT}" "${REG_APP_PATH}" "Path" "$INSTDIR\bin\" ${WriteRegStr} "${REG_ROOT}" "${REG_APP_PATH}" "Path" "$INSTDIR\bin\"
${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "qTox" ${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "qTox"
${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion" "1.8.1"
${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "The qTox Project" ${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "The qTox Project"
${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe" ${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe"
${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "URLInfoAbout" "https://qtox.github.io" ${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "URLInfoAbout" "https://qtox.github.io"

View File

@ -281,6 +281,7 @@ Section "Install"
${WriteRegStr} "${REG_ROOT}" "${REG_APP_PATH}" "" "$INSTDIR\${MAIN_APP_EXE}" ${WriteRegStr} "${REG_ROOT}" "${REG_APP_PATH}" "" "$INSTDIR\${MAIN_APP_EXE}"
${WriteRegStr} "${REG_ROOT}" "${REG_APP_PATH}" "Path" "$INSTDIR\bin\" ${WriteRegStr} "${REG_ROOT}" "${REG_APP_PATH}" "Path" "$INSTDIR\bin\"
${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "qTox" ${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "qTox"
${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion" "1.8.1"
${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "The qTox Project" ${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "The qTox Project"
${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe" ${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe"
${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "URLInfoAbout" "https://qtox.github.io" ${WriteRegStr} ${REG_ROOT} "${UNINSTALL_PATH}" "URLInfoAbout" "https://qtox.github.io"