nextcloud-desktop/admin/linux/debian/drone-build.sh

140 lines
4 KiB
Bash
Raw Normal View History

2018-01-06 19:03:10 +03:00
#!/bin/bash
set -xe
shopt -s extglob
env
2018-11-13 22:49:26 +03:00
PPA=ppa:nextcloud-devs/client
PPA_ALPHA=ppa:nextcloud-devs/client-alpha
2018-11-13 22:49:26 +03:00
PPA_BETA=ppa:nextcloud-devs/client-beta
2018-01-06 19:03:10 +03:00
2018-11-13 18:47:06 +03:00
OBS_PROJECT=home:ivaradi
OBS_PROJECT_ALPHA=home:ivaradi:alpha
2018-11-13 18:47:06 +03:00
OBS_PROJECT_BETA=home:ivaradi:beta
OBS_PACKAGE=nextcloud-desktop
if test "${DRONE_TARGET_BRANCH}" = "stable-2.6"; then
UBUNTU_DISTRIBUTIONS="bionic focal jammy kinetic"
DEBIAN_DISTRIBUTIONS="buster stretch testing"
else
UBUNTU_DISTRIBUTIONS="jammy kinetic"
DEBIAN_DISTRIBUTIONS="bullseye testing"
fi
2018-01-06 19:03:10 +03:00
pull_request=${DRONE_PULL_REQUEST:=master}
if test -z "${DRONE_WORKSPACE}"; then
DRONE_WORKSPACE=`pwd`
fi
if test -z "${DRONE_DIR}"; then
DRONE_DIR=`dirname ${DRONE_WORKSPACE}`
fi
2018-01-06 19:03:10 +03:00
2018-01-30 21:22:26 +03:00
set +x
2018-01-06 19:03:10 +03:00
if test "$DEBIAN_SECRET_KEY" -a "$DEBIAN_SECRET_IV"; then
openssl aes-256-cbc -K $DEBIAN_SECRET_KEY -iv $DEBIAN_SECRET_IV -in admin/linux/debian/signing-key.txt.enc -d | gpg --import
openssl aes-256-cbc -K $DEBIAN_SECRET_KEY -iv $DEBIAN_SECRET_IV -in admin/linux/debian/oscrc.enc -out ~/.oscrc -d
touch ~/.has_ppa_keys
fi
2018-01-30 21:22:26 +03:00
set -x
2018-01-06 19:03:10 +03:00
cd "${DRONE_WORKSPACE}"
git fetch --tags
read basever revdate kind <<<$(admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog stable)
2018-01-06 19:03:10 +03:00
cd "${DRONE_DIR}"
2018-01-06 19:03:10 +03:00
echo "$kind" > kind
if test "$kind" = "alpha"; then
repo=nextcloud-devs/client-alpha
elif test "$kind" = "beta"; then
2018-07-15 14:20:00 +03:00
repo=nextcloud-devs/client-beta
else
repo=nextcloud-devs/client
2018-01-06 19:03:10 +03:00
fi
origsourceopt=""
cp -a ${DRONE_WORKSPACE} nextcloud-desktop_${basever}-${revdate}
tar cjf nextcloud-desktop_${basever}-${revdate}.orig.tar.bz2 --exclude .git --exclude binary nextcloud-desktop_${basever}-${revdate}
2018-01-06 19:03:10 +03:00
cd "${DRONE_WORKSPACE}"
git config --global user.email "drone@noemail.invalid"
git config --global user.name "Drone User"
2018-01-06 19:03:10 +03:00
for distribution in ${UBUNTU_DISTRIBUTIONS} ${DEBIAN_DISTRIBUTIONS}; do
git checkout -- .
git clean -xdf
2018-01-06 19:03:10 +03:00
git fetch origin debian/dist/${distribution}/${DRONE_TARGET_BRANCH}
git checkout origin/debian/dist/${distribution}/${DRONE_TARGET_BRANCH}
2018-01-06 19:03:10 +03:00
git merge ${DRONE_COMMIT}
2018-02-01 21:22:46 +03:00
admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog ${distribution} ${revdate} ${basever}
cat /tmp/tmpchangelog debian/changelog > debian/changelog.new
mv debian/changelog.new debian/changelog
2018-02-01 21:22:46 +03:00
fullver=`head -1 debian/changelog | sed "s:nextcloud-desktop (\([^)]*\)).*:\1:"`
2018-01-06 19:03:10 +03:00
EDITOR=true dpkg-source --commit . local-changes
dpkg-source --build .
dpkg-genchanges -S -sa > "../nextcloud-desktop_${fullver}_source.changes"
2018-01-06 19:03:10 +03:00
if test -f ~/.has_ppa_keys; then
debsign -k2265D8767D14AA7B -S
fi
2018-01-06 19:03:10 +03:00
done
cd ..
ls -al
2018-01-06 19:03:10 +03:00
if test "${pull_request}" = "master"; then
if test "$kind" = "alpha"; then
PPA=$PPA_ALPHA
OBS_PROJECT=$OBS_PROJECT_ALPHA
elif test "$kind" = "beta"; then
2018-01-06 19:03:10 +03:00
PPA=$PPA_BETA
OBS_PROJECT=$OBS_PROJECT_BETA
fi
if test -f ~/.has_ppa_keys; then
for distribution in ${UBUNTU_DISTRIBUTIONS}; do
changes=$(ls -1 nextcloud-desktop_*~${distribution}1_source.changes)
if test -f "${changes}"; then
dput $PPA "${changes}" > /dev/null
fi
2018-01-06 19:03:10 +03:00
done
for distribution in ${DEBIAN_DISTRIBUTIONS}; do
pkgsuffix=".${distribution}"
pkgvertag="~${distribution}1"
package="${OBS_PACKAGE}${pkgsuffix}"
OBS_SUBDIR="${OBS_PROJECT}/${package}"
mkdir -p osc
pushd osc
osc co ${OBS_PROJECT} ${package}
if test "$(ls ${OBS_SUBDIR})"; then
osc delete ${OBS_SUBDIR}/*
fi
cp ../nextcloud-desktop*.orig.tar.* ${OBS_SUBDIR}/
cp ../nextcloud-desktop_*[0-9.][0-9]${pkgvertag}.dsc ${OBS_SUBDIR}/
cp ../nextcloud-desktop_*[0-9.][0-9]${pkgvertag}.debian.tar* ${OBS_SUBDIR}/
cp ../nextcloud-desktop_*[0-9.][0-9]${pkgvertag}_source.changes ${OBS_SUBDIR}/
osc add ${OBS_SUBDIR}/*
cd ${OBS_SUBDIR}
osc commit -m "Travis update"
popd
done
2018-01-06 19:03:10 +03:00
fi
fi