~dricottone/huttese-apk

ref: 4482212909d628f37d778d65a6afb32f4f394e01 huttese-apk/sr.ht/build.yml -rw-r--r-- 2.9 KiB
44822129 — Drew DeVault Add submit-builds script 5 years ago
                                                                                
9b905648 Drew DeVault
44822129 Drew DeVault
9b905648 Drew DeVault
2d4617dc Drew DeVault
9b905648 Drew DeVault
10f9adf8 Drew DeVault
9b905648 Drew DeVault
10f9adf8 Drew DeVault
9b905648 Drew DeVault
10f9adf8 Drew DeVault
9b905648 Drew DeVault
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
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: []
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