Add deb and rpm packages on releases

This commit is contained in:
Konstantinos Sideris 2017-12-26 19:08:00 +02:00
parent 1ab55d4732
commit 155a9e828d
5 changed files with 81 additions and 7 deletions

49
.ci/linux/create-packages.sh Executable file
View file

@ -0,0 +1,49 @@
#!/usr/bin/env bash
#
# Create deb & rpm packages from the AppImage.
#
DIR=package.dir
VERSION=`git tag -l --points-at HEAD`
# Installing dependencies on travis.
if [ ! -z "$TRAVIS_OS_NAME" ]; then
sudo apt-add-repository -y ppa:brightbox/ruby-ng
sudo apt-get update -qq
sudo apt-get install -y ruby2.1 ruby-switch
sudo ruby-switch --set ruby2.1
sudo apt-get install -y ruby2.1-dev rpm libffi-dev
sudo gem install --no-ri --no-rdoc fpm
fi
# Set up deb structure.
mkdir -p ${DIR}/usr/{bin,share/pixmaps,share/applications}
# Copy resources.
cp nheko*.AppImage ${DIR}/usr/bin/nheko
cp resources/nheko.desktop ${DIR}/usr/share/applications/nheko.desktop
cp resources/nheko.png ${DIR}/usr/share/pixmaps/nheko.png
for iconSize in 16 32 48 64 128 256 512; do
IconDir=${DIR}/usr/share/icons/hicolor/${iconSize}x${iconSize}/apps
mkdir -p ${IconDir}
cp resources/nheko-${iconSize}.png ${IconDir}/nheko.png
done
fpm --force \
-s dir \
--output-type deb \
--name nheko \
--description "Desktop client for the Matrix protocol" \
--url "https://github.com/mujx/nheko" \
--version ${VERSION} \
--architecture x86_64 \
--maintainer "mujx (https://github.com/mujx)" \
--license "GPLv3" \
--prefix / \
--deb-no-default-config-files \
--chdir ${DIR} usr
fpm -s deb -t rpm nheko_${VERSION}_amd64.deb

View file

@ -52,6 +52,11 @@ script:
- if [ $TRAVIS_OS_NAME == osx ]; then make lint; fi
- if [ $TRAVIS_OS_NAME == osx ] && [ $DEPLOYMENT == 1 ]; then ./.ci/macos/deploy.sh; fi
- if [ $TRAVIS_OS_NAME == linux ] && [ $DEPLOYMENT == 1 ]; then ./.ci/linux/deploy.sh; fi
- if [ $TRAVIS_OS_NAME == linux ] && [ $DEPLOYMENT == 1 ]; then ./.ci/linux/create-packages.sh; fi
before_deploy:
- export RELEASE_DEB_FILE=$(ls *.deb)
- export RELEASE_RPM_FILE=$(ls *.rpm)
deploy:
- skip_cleanup: true
@ -59,11 +64,16 @@ deploy:
provider: releases
api_key:
secure: oprXzESukFiXBeF2BXkXUlegsAQc95Ub4kc/OkoNFaYBvqpA+IGpWHmHCx5JPny/OT3Kc2Urpe2JUeGSWDHZ7UCKDjH+NzGP3uN82fHh/HiszG/Srw7+hWEHm1ve+gMK9GS8pr+yUsUrPP0UfVXlPoI4pBWa4zGi2Ndb/SqvjCgIHFLtGyoBo6CydKQ/AyWiXSMKDfJL+Dx4JLIPP4RTCBJy8ZrZ8m/a5Tgy4Ij6+djjrgYCZCEhGxSYw7xDIT/9SV8g9NkrbisqBDrILzAH8Yhe4XMRMXo88OAxV5+Vb9Rw1hrqczez6lpFDbJetv8MjofND+pSoAFwtjaL1wTFK9Ud6w4O9AuHlEQH9cGVdvsxFcosRwJVh58x51JM9ptoktqhx/HHJBTuCHCYYlHwtRwbwqnMYdLzKZG5FnujT8DG+9mcva1fL6tzW/XD505VPMWwXFC/2/pvolgAkTFFXYSALAwZlK3IgoXU8Gok/3B4iHofzQsFf6Yq3BI/88x7tVASUqiYhoKrO50+gb6pNIRCyWgGUiBEVXBp6Ziq3ORQPyQJg7i9HHUGTUu74yvGLHWLwjNQzZP/hxJZK3VlJxzyXntdOxiJc8iOzNrU+rPKBAlAaE6bQDOoniIysEgdD5BXHTLFzPvts4P1n2Ckor5/rNJ+qXR8GU+/y7e1GKU=
file: nheko-x86_64.AppImage
file_glob: true
file:
- nheko-x86_64.AppImage
- $RELEASE_DEB_FILE
- $RELEASE_RPM_FILE
on:
condition: $TRAVIS_OS_NAME == linux && $DEPLOYMENT == 1
repo: mujx/nheko
tags: true
- skip_cleanup: true
overwrite: true
provider: releases

View file

@ -291,12 +291,15 @@ add_custom_target(LANG_QRC ALL DEPENDS ${QM_SRC})
# Generate a qrc file for the translations
set(_qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
file(WRITE ${_qrc} "<RCC> <qresource prefix=\"/translations\">")
foreach(_lang ${QM_SRC})
get_filename_component(_filename ${_lang} NAME)
file(APPEND ${_qrc} "<file>${_filename}</file>")
endforeach(_lang)
file(APPEND ${_qrc} "</qresource> </RCC>")
if(NOT EXISTS ${_qrc})
file(WRITE ${_qrc} "<RCC> <qresource prefix=\"/translations\">")
foreach(_lang ${QM_SRC})
get_filename_component(_filename ${_lang} NAME)
file(APPEND ${_qrc} "<file>${_filename}</file>")
endforeach(_lang)
file(APPEND ${_qrc} "</qresource> </RCC>")
endif()
qt5_add_resources(LANG_QRC ${_qrc})
qt5_add_resources(QRC resources/res.qrc)

View file

@ -31,6 +31,9 @@ RUN update-alternatives --install \
clang-format \
/usr/bin/clang-format-5.0 100
RUN apt-get -y install ruby ruby-dev rubygems rpm && \
gem install --no-ri --no-rdoc fpm
ENV PATH=/opt/qt59/bin:$PATH
RUN mkdir /build

View file

@ -41,5 +41,14 @@ docker-app-image: image
--privileged \
-v `pwd`:/build nheko-app-image make linux-appimage
docker-packages: image
docker run \
-e CXX=g++-7 \
-e CC=gcc-7 \
-v `pwd`:/build nheko-app-image make release
docker run \
--privileged \
-v `pwd`:/build nheko-app-image ./.ci/linux/create-packages.sh
clean:
rm -rf build