~dricottone/huttese-apk

9b90564868c0c0db6c4513184c0c9290a527d18d — Drew DeVault 5 years ago 569ba8a
Add buildall.yml
1 files changed, 101 insertions(+), 0 deletions(-)

A sr.ht/buildall.yml
A sr.ht/buildall.yml => sr.ht/buildall.yml +101 -0
@@ 0,0 1,101 @@
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
environment:
  repo_server: deploy@mirror.sr.ht
  repo_path: /var/www/mirror.sr.ht/alpine/sr.ht/x86_64
  packages:
    - py-alembic
    - py-editor
    - py-qrcode
    - py3-amqp
    - py3-anyjson
    - py3-arrow
    - py3-billiard
    - py3-bleach
    - py3-case
    - py3-celery
    - py3-colour
    - py3-furl
    - py3-html5lib
    - py3-humanize
    - py3-infinity
    - py3-intervals
    - py3-kombu
    - py3-nose
    - py3-orderedmultidict
    - py3-passlib
    - py3-pgpy
    - py3-pyotp
    - py3-redis
    - py3-sqlalchemy-utils
    - py3-sshpubkeys
    - py3-stripe
    - py3-vine
    - py3-webencodings
sources:
  - https://git.sr.ht/~sircmpwn/sr.ht-apkbuilds
secrets:
  - fa00a8d3-7b63-42d5-8060-3bb31c3e3018 # ssh deploy key
  - d0adc1d4-af78-4852-920f-1134392f5d10 # package signing key
tasks:
  - setup: |
      mkdir ~/packages
      cat <<'EOF' >>~/.buildenv
      function get_pkgvar() {
          var="$1"
          (
              set +u
              . APKBUILD
              eval 'printf "%s\n" "$'"$var"'"'
          )
      }
      EOF
      echo 'PACKAGER_PRIVKEY="/home/build/.abuild/alpine@sr.ht.rsa"' >> \
        ~/.abuild/abuild.conf
  - build: |
      cd sr.ht-apkbuilds/sr.ht
      for package in "${packages[@]}"
      do
          cd "$package"
          pkgver="$(get_pkgvar pkgver)"
          prev_pkgver=$(apk search "$package" | cut -d '-' -f2-)
          prev_pkgrel=$(printf "%s" "$prev_pkgver" | cut -d'-' -f2 | cut -d'r' -f2)
          pkgrel=$((prev_pkgrel + 1))
          sed -e "s/pkgrel=.*/pkgrel=$pkgrel/" -i APKBUILD
          abuild checksum
          abuild -r
          sudo apk add ~/packages/sr.ht/$(uname -m)/"$package"-$pkgver-r$pkgrel.apk
          cd ..
      done
  - deploy: |
      cd sr.ht-apkbuilds/sr.ht
      sshopts="-o StrictHostKeyChecking=no"
      set -u
      for package in "${packages[@]}"
      do
          cd "$package"
          ssh $sshopts $repo_server rm -f $repo_path/${package}'*.apk'
          pkgver="$(get_pkgvar pkgver)"
          pkgrel="$(get_pkgvar pkgrel)"
          rsync --blocking-io \
            -rPe "ssh $sshopts" \
            ~/packages/sr.ht/$(uname -m)/"$package"-$pkgver-r$pkgrel.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/
          cd ..
      done