From eae0fbe2031f085f3ce1809b3c055ef99a7e75e2 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 27 Dec 2018 16:31:58 -0500 Subject: Add Alpine build --- .build.yml | 56 ------------------------------------- .builds/alpine.yml | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ .builds/archlinux.yml | 56 +++++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+), 56 deletions(-) delete mode 100644 .build.yml create mode 100644 .builds/alpine.yml create mode 100644 .builds/archlinux.yml diff --git a/.build.yml b/.build.yml deleted file mode 100644 index 8b14449..0000000 --- a/.build.yml +++ /dev/null @@ -1,56 +0,0 @@ -image: archlinux -repositories: - sr.ht: https://mirror.sr.ht/archlinux/sr.ht/#1ED4E14494433AE3FD302CAB74B4BCCEA60D0437 -packages: - - sassc - - python-setuptools - - python-srht - - python-pygit2 - - python-celery - - python-redis - - python-flask-login - - rsync - - pacman-contrib -sources: - - https://git.sr.ht/~sircmpwn/man.sr.ht - - https://git.sr.ht/~sircmpwn/sr.ht-pkgbuilds -environment: - repo_server: deploy@mirror.sr.ht - repo_path: /var/www/mirror.sr.ht/archlinux/sr.ht/ - master: deploy@man.sr.ht -secrets: - - fa00a8d3-7b63-42d5-8060-3bb31c3e3018 # ssh deploy key - - 3e65a1a8-a20f-4f6b-a452-df2ac398bc1e # package signing key -tasks: - - build: | - cd man.sr.ht - ./setup.py build - - archive: | - cd man.sr.ht - pkgver=$(git describe | sed -e 's/-/_/g') - echo "pkgver=$pkgver" >> ~/.buildenv - git archive -o ~/sr.ht-pkgbuilds/man.sr.ht/man.sr.ht-$pkgver.tar.xz \ - --prefix=man.sr.ht-$pkgver/ HEAD - - package: | - cd sr.ht-pkgbuilds/man.sr.ht - pkgrel=$(pacman -Si man.sr.ht | grep Version | cut -d'-' -f2) - pkgrel=$(expr $pkgrel + 1) - sed -e "s/pkgver=.*/pkgver=$pkgver/" -i PKGBUILD - sed -e "s/pkgrel=.*/pkgrel=$pkgrel/" -i PKGBUILD - echo "pkgrel=$pkgrel" >> ~/.buildenv - updpkgsums - makepkg --config ../makepkg.conf -s --noconfirm - cd ~/man.sr.ht - git describe --exact-match HEAD || complete-build - - deploy: | - cd sr.ht-pkgbuilds/man.sr.ht - sshopts="-o StrictHostKeyChecking=no" # TODO: remove this when builds run on a tty - rsync --blocking-io \ - --rsh="ssh $sshopts" -rP *.pkg.tar.xz{,.sig} $repo_server:$repo_path/ - ssh $sshopts $repo_server repo-add -n -R \ - $repo_path/sr.ht.db.tar.gz \ - $repo_path/man.sr.ht-$pkgver-$pkgrel-any.pkg.tar.xz - ssh $sshopts $repo_server repo-add -n -R \ - $repo_path/sr.ht.db.tar.gz \ - $repo_path/man.sr.ht-images-$pkgver-$pkgrel-any.pkg.tar.xz - ssh $sshopts $master sudo /usr/local/bin/update-srht man.sr.ht diff --git a/.builds/alpine.yml b/.builds/alpine.yml new file mode 100644 index 0000000..e5c07c2 --- /dev/null +++ b/.builds/alpine.yml @@ -0,0 +1,76 @@ +image: alpine/edge +repositories: + sr.ht: > + https://mirror.sr.ht/alpine/sr.ht/ + https://mirror.sr.ht/alpine/sr.ht/alpine%40sr.ht.rsa.pub + alpine@sr.ht.rsa.pub +packages: + - rsync + - xz +sources: + - https://git.sr.ht/~sircmpwn/man.sr.ht + - https://git.sr.ht/~sircmpwn/sr.ht-apkbuilds +environment: + project: man.sr.ht + repo_server: deploy@mirror.sr.ht + repo_path: /var/www/mirror.sr.ht/alpine/sr.ht/x86_64 + master: man.sr.ht +secrets: + - fa00a8d3-7b63-42d5-8060-3bb31c3e3018 # ssh deploy key + - d0adc1d4-af78-4852-920f-1134392f5d10 # package signing key +tasks: + - archive: | + cd ${project} + pkgver=$(git describe --abbrev=0) + if ! git describe --exact-match HEAD + then + cdate=$(git show -s -1 --format='%ci' HEAD) + cdate=$(echo "$cdate" | cut -d' ' -f1 | sed -e 's/-//g') + pkgver="${pkgver}_git${cdate}" + fi + echo "pkgver=$pkgver" >> ~/.buildenv + git archive --prefix=${project}-$pkgver/ HEAD | xz \ + > ~/sr.ht-apkbuilds/sr.ht/${project}/${project}-$pkgver.tar.xz + - package: | + cd sr.ht-apkbuilds/sr.ht/${project} + echo 'PACKAGER_PRIVKEY="/home/build/.abuild/alpine@sr.ht.rsa"' >> \ + ~/.abuild/abuild.conf + prev_pkgver=$(apk search -x ${project} | cut -d '-' -f3-) + prev_pkgrel=$(printf "%s" "$prev_pkgver" | cut -d'-' -f2 | cut -c2-) + prev_pkgver=$(printf "%s" "$prev_pkgver" | cut -d'-' -f1) + if [ "$prev_pkgver" = "$pkgver" ] + then + pkgrel=$(($prev_pkgrel + 1)) + else + pkgrel=1 + fi + sed -e "s/pkgver=.*/pkgver=$pkgver/" -i APKBUILD + sed -e "s/pkgrel=.*/pkgrel=$pkgrel/" -i APKBUILD + sed -e "s?http://git.sr.ht/.*/snapshot/??g" -i APKBUILD + cat APKBUILD + echo "pkgrel=$pkgrel" >> ~/.buildenv + abuild checksum + abuild -r + cd ~/${project} + git describe --exact-match HEAD || complete-build + - publish: | + cd ~/packages/sr.ht/x86_64 + sshopts="-o StrictHostKeyChecking=no" + set -u + ssh $sshopts $repo_server rm -f $repo_path/${project}'*.apk' + rsync --blocking-io \ + -rPe "ssh $sshopts" *.apk $repo_server:$repo_path/ + ssh $sshopts $repo_server find $repo_path -type f -name '*.apk' -print0 | + ssh $sshopts $repo_server xargs -0 apk index \ + --rewrite-arch x86_64 \ + -x $repo_path/APKINDEX.tar.gz \ + -o $repo_path/APKINDEX.unsigned.tar.gz + rsync --blocking-io -rPe "ssh $sshopts" \ + $repo_server:$repo_path/APKINDEX.unsigned.tar.gz APKINDEX.tar.gz + abuild-sign -k ~/.abuild/alpine@sr.ht.rsa APKINDEX.tar.gz + rsync --blocking-io -rPe "ssh $sshopts" \ + APKINDEX.tar.gz $repo_server:$repo_path/ + - deploy: | + sshopts="-o StrictHostKeyChecking=no" + ssh $sshopts deploy@$master doas apk upgrade -U + ssh $sshopts deploy@$master doas service man.sr.ht restart diff --git a/.builds/archlinux.yml b/.builds/archlinux.yml new file mode 100644 index 0000000..8b14449 --- /dev/null +++ b/.builds/archlinux.yml @@ -0,0 +1,56 @@ +image: archlinux +repositories: + sr.ht: https://mirror.sr.ht/archlinux/sr.ht/#1ED4E14494433AE3FD302CAB74B4BCCEA60D0437 +packages: + - sassc + - python-setuptools + - python-srht + - python-pygit2 + - python-celery + - python-redis + - python-flask-login + - rsync + - pacman-contrib +sources: + - https://git.sr.ht/~sircmpwn/man.sr.ht + - https://git.sr.ht/~sircmpwn/sr.ht-pkgbuilds +environment: + repo_server: deploy@mirror.sr.ht + repo_path: /var/www/mirror.sr.ht/archlinux/sr.ht/ + master: deploy@man.sr.ht +secrets: + - fa00a8d3-7b63-42d5-8060-3bb31c3e3018 # ssh deploy key + - 3e65a1a8-a20f-4f6b-a452-df2ac398bc1e # package signing key +tasks: + - build: | + cd man.sr.ht + ./setup.py build + - archive: | + cd man.sr.ht + pkgver=$(git describe | sed -e 's/-/_/g') + echo "pkgver=$pkgver" >> ~/.buildenv + git archive -o ~/sr.ht-pkgbuilds/man.sr.ht/man.sr.ht-$pkgver.tar.xz \ + --prefix=man.sr.ht-$pkgver/ HEAD + - package: | + cd sr.ht-pkgbuilds/man.sr.ht + pkgrel=$(pacman -Si man.sr.ht | grep Version | cut -d'-' -f2) + pkgrel=$(expr $pkgrel + 1) + sed -e "s/pkgver=.*/pkgver=$pkgver/" -i PKGBUILD + sed -e "s/pkgrel=.*/pkgrel=$pkgrel/" -i PKGBUILD + echo "pkgrel=$pkgrel" >> ~/.buildenv + updpkgsums + makepkg --config ../makepkg.conf -s --noconfirm + cd ~/man.sr.ht + git describe --exact-match HEAD || complete-build + - deploy: | + cd sr.ht-pkgbuilds/man.sr.ht + sshopts="-o StrictHostKeyChecking=no" # TODO: remove this when builds run on a tty + rsync --blocking-io \ + --rsh="ssh $sshopts" -rP *.pkg.tar.xz{,.sig} $repo_server:$repo_path/ + ssh $sshopts $repo_server repo-add -n -R \ + $repo_path/sr.ht.db.tar.gz \ + $repo_path/man.sr.ht-$pkgver-$pkgrel-any.pkg.tar.xz + ssh $sshopts $repo_server repo-add -n -R \ + $repo_path/sr.ht.db.tar.gz \ + $repo_path/man.sr.ht-images-$pkgver-$pkgrel-any.pkg.tar.xz + ssh $sshopts $master sudo /usr/local/bin/update-srht man.sr.ht -- cgit v1.2.3