1
0
mirror of https://github.com/danog/repo.git synced 2024-11-27 10:54:47 +01:00
repo/script/cibuild
2015-09-24 10:55:09 +02:00

82 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
[ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ] && {
# Setup everything
sudo apt-get update &>/dev/null
sudo apt-get install reprepro gnupg expect tree -y >/dev/null
tar -xzf enc.tar.gz
gpg --allow-secret-key-import --import mygpgkey_sec.gpg
mkdir temp
temp="$PWD/temp"
reprepro="$PWD/ex"
chmod +x ${reprepro}
gitsync() {
branch="${1}"
shift
[ "${branch}" != "master" ] && {
echo "branches:
except:
- ${branch}" > .travis.yml
echo "vendor
s.key" >.gitignore
}
git add -A
git commit -am "${*}"
git push -fq origin ${branch}
}
git clone https://${GH_TOKEN}@github.com/danog/repo.git
cd repo
git config --global user.name "${GIT_NAME}"
git config --global user.email "${GIT_EMAIL}"
git config --global push.default simple
git log -1 --pretty=%B | grep -q madebytravisci && exit 0
root="$PWD"
########################################
cd reprepro
[ "$(ls $root/debs)" != "" ] && {
# Import debs into reprepro
for f in $root/debs/*; do {
deb="$(ls $f/*.deb)"
changes="$(ls $f/*.changes)"
dsc="$(ls $f/*.dsc)"
name="$(dpkg --info ${deb} | grep Package | sed 's/.*Package:\s//')"
${reprepro} remove lenny ${name}
[ "$changes" != "" ] && {
${reprepro} include lenny ${changes} && rm -r $f
} || {
${reprepro} includedeb lenny ${deb} && ${reprepro} includedsc lenny ${dsc} && rm -r $f
}
total="${total}, ${name}"
}; done
}
tree -T "Daniil's repo" -C -H http://repo.daniil.it -o tree.html
cp -a * $temp
# Generate website
cd $root/jekyll
echo "---
layout: default
---
">index.md
cat ../README.md >> index.md
cp -a * $temp
cd $root
gitsync master OK madebytravisci
# Upload everything
git branch -d gh-pages
git checkout --orphan gh-pages
git rm -rf .
cp -a $temp/* .
gitsync gh-pages "Added/updated ${total}"
}