1
0
mirror of https://github.com/danog/repo.git synced 2024-11-27 13:34:45 +01:00
repo/script/cibuild

82 lines
1.7 KiB
Plaintext
Raw Normal View History

2015-09-22 21:51:16 +02:00
#!/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
2015-09-23 12:18:35 +02:00
tar -xzf enc.tar.gz
2015-09-23 17:07:29 +02:00
gpg --allow-secret-key-import --import mygpgkey_sec.gpg
2015-09-22 21:51:16 +02:00
mkdir temp
temp="$PWD/temp"
2015-09-23 10:56:11 +02:00
2015-09-23 12:05:58 +02:00
reprepro="$PWD/ex"
2015-09-22 21:51:16 +02:00
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
2015-09-24 10:55:09 +02:00
[ "$(ls $root/debs)" != "" ] && {
2015-09-22 21:51:16 +02:00
# Import debs into reprepro
2015-09-24 10:35:54 +02:00
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
2015-09-22 21:51:16 +02:00
}
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}"
}