Rename builds with version in Travis

This commit is contained in:
Florian Märkl 2018-10-02 13:21:39 +02:00
parent 9a73e49796
commit e3bc744024
2 changed files with 30 additions and 3 deletions

View File

@ -69,6 +69,7 @@ script:
fi fi
after_success: after_success:
- export CUTTER_VERSION=$(python ../scripts/get_version.py)
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
cp ../src/macos/Cutter.sh Cutter.app/Contents/MacOS/Cutter.sh && chmod +x Cutter.app/Contents/MacOS/Cutter.sh && cp ../src/macos/Cutter.sh Cutter.app/Contents/MacOS/Cutter.sh && chmod +x Cutter.app/Contents/MacOS/Cutter.sh &&
macdeployqt Cutter.app -executable=Cutter.app/Contents/MacOS/Cutter && macdeployqt Cutter.app -executable=Cutter.app/Contents/MacOS/Cutter &&
@ -76,8 +77,9 @@ after_success:
mkdir -p Cutter.app/Contents/Resources/r2/share && mkdir -p Cutter.app/Contents/Resources/r2/share &&
cp -a /usr/local/share/radare2 Cutter.app/Contents/Resources/r2/share/ && cp -a /usr/local/share/radare2 Cutter.app/Contents/Resources/r2/share/ &&
mkdir image && cp -a Cutter.app image/ && mkdir image && cp -a Cutter.app image/ &&
hdiutil create -srcfolder image -volname Cutter -fs HFS+ Cutter.dmg && export DMG_FILE="Cutter-v$CUTTER_VERSION.dmg" &&
export FILE_TO_UPLOAD="Cutter.dmg" hdiutil create -srcfolder image -volname Cutter -fs HFS+ "$DMG_FILE" &&
export FILE_TO_UPLOAD="$DMG_FILE"
; fi ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
make INSTALL_ROOT=appdir install && make INSTALL_ROOT=appdir install &&
@ -89,7 +91,9 @@ after_success:
LD_LIBRARY_PATH=$CUSTOM_PYTHON_PREFIX/lib ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -bundle-non-qt-libs -no-strip -exclude-libs=libnss3.so,libnssutil3.so -ignore-glob=usr/lib/python3.6/** -verbose=2 && LD_LIBRARY_PATH=$CUSTOM_PYTHON_PREFIX/lib ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -bundle-non-qt-libs -no-strip -exclude-libs=libnss3.so,libnssutil3.so -ignore-glob=usr/lib/python3.6/** -verbose=2 &&
LD_LIBRARY_PATH=$CUSTOM_PYTHON_PREFIX/lib ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -appimage -no-strip -exclude-libs=libnss3.so,libnssutil3.so -ignore-glob=usr/lib/python3.6/** -verbose=2 && LD_LIBRARY_PATH=$CUSTOM_PYTHON_PREFIX/lib ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -appimage -no-strip -exclude-libs=libnss3.so,libnssutil3.so -ignore-glob=usr/lib/python3.6/** -verbose=2 &&
find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq && find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq &&
export FILE_TO_UPLOAD="Cutter-x86_64.AppImage" export APPIMAGE_FILE="Cutter-v$CUTTER_VERSION-x86_64.AppImage" &&
mv Cutter-x86_64.AppImage "$APPIMAGE_FILE" &&
export FILE_TO_UPLOAD="$APPIMAGE_FILE"
; fi ; fi
deploy: deploy:

23
scripts/get_version.py Normal file
View File

@ -0,0 +1,23 @@
import os
import re
scripts_path = os.path.dirname(os.path.realpath(__file__))
pro_file_path = os.path.join(scripts_path, "..", "src", "Cutter.pro")
with open(pro_file_path, "r") as f:
pro_content = f.read()
def version_var_re(name):
return "^[ \t]*{}[ \t]*=[ \t]*(\d)+[ \t]*$".format(name)
m = re.search(version_var_re("CUTTER_VERSION_MAJOR"), pro_content, flags=re.MULTILINE)
version_major = int(m.group(1)) if m is not None else 0
m = re.search(version_var_re("CUTTER_VERSION_MINOR"), pro_content, flags=re.MULTILINE)
version_minor = int(m.group(1)) if m is not None else 0
m = re.search(version_var_re("CUTTER_VERSION_PATCH"), pro_content, flags=re.MULTILINE)
version_patch = int(m.group(1)) if m is not None else 0
print("{}.{}.{}".format(version_major, version_minor, version_patch))