~dricottone/huttese-apk

ref: 73476f4260c7d818682639b0379d52f72cce2916 huttese-apk/sr.ht/buildall.yml -rw-r--r-- 3.5 KiB
73476f42 — Drew DeVault Add lists.sr.ht & its dependencies 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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:
    - fcgiwrap
    - py-alembic
    - py-cssselect2
    - py-editor
    - py-misaka
    - py-qrcode
    - py-tinycss2
    - py-weasyprint
    - 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 -x "$package" | cut -c$((${#package}+2))-)
          prev_pkgrel=$(printf "%s" "$prev_pkgver" | cut -d'-' -f2 | cut -d'r' -f2)
          if [ "$prev_pkgver" != "$pkgver" ]
          then
              pkgrel=$((prev_pkgrel + 1))
              sed -e "s/pkgrel=.*/pkgrel=$pkgrel/" -i APKBUILD
          fi
          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)"
          subpkgs="$(get_pkgvar subpackages)"
          rsync --blocking-io \
            -rPe "ssh $sshopts" \
            ~/packages/sr.ht/$(uname -m)/"$package"-$pkgver-r$pkgrel.apk \
            $repo_server:$repo_path/
          for subp in $subpkgs
          do
              subp="$(printf '%s' "$subp" | cut -d: -f1)"
              rsync --blocking-io \
                -rPe "ssh $sshopts" \
                ~/packages/sr.ht/$(uname -m)/"$subp"-$pkgver-r$pkgrel.apk \
                $repo_server:$repo_path/
          done
          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