summarylogtreecommitdiffstats
path: root/justfile
blob: d66a9fcd5f4ae2048001d6afc3c0f8a5cc15fac8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
update version:
  #!/usr/bin/env bash
  set -euxo pipefail

  version="{{ version }}"
  version="${version//-/_}"

  source PKGBUILD
  if [ "$version" = "$pkgver" ]; then
    sed --regexp-extended --in-place -E "0,/pkgrel=.+$/{s/(pkgrel=)(.+$)/\1$((pkgrel+1))/}" ./PKGBUILD
  else
    sed --regexp-extended --in-place -E "0,/pkgrel=.+$/{s/(pkgrel=)(.+$)/\11/}" ./PKGBUILD
  fi

  sed --regexp-extended --in-place -E "0,/pkgver=.+$/{s/(pkgver=)(.+$)/\1${version}/}" ./PKGBUILD
  shas=$(makepkg --geninteg)
  sed --regexp-extended --in-place -E "0,/sha512sums=.+$/{s/sha512sums=.+$/${shas}/}" ./PKGBUILD
  makepkg --printsrcinfo > .SRCINFO
  git commit --all --message $(echo {{version}} | tr -d '"'})