github.com/drud/ddev@v1.21.5-alpha1.0.20230226034409-94fcc4b94453/.ci-scripts/bump_aur.sh (about) 1 #!/bin/bash 2 3 # Requires $AUR_SSH_PRIVATE_KEY, a private key in environment variable 4 # This environment variable must be a single line, with \n replaced by "<SPLIT>" 5 6 set -o errexit 7 set -o pipefail 8 set -o nounset 9 10 if [ -z "${AUR_SSH_PRIVATE_KEY:-}" ]; then 11 printf "\$AUR_SSH_PRIVATE_KEY must be set in the environment. It should be a single line with \n replaced by <SPLIT>" && exit 101 12 fi 13 if [ "$#" != "3" ]; then 14 printf "Arguments: AUR_REPO (AUR repo ddev-bin or ddev-edge-bin) \nVERSION_NUMBER (like v1.14.2) \nARTIFACTS_DIR (like /home/circleci/artifacts)\n" && exit 102 15 fi 16 17 # For testing, you can change GITHUB_USERNAME to, for example, rfay so releases can be tested 18 # without bothering people. 19 GITHUB_USERNAME=drud 20 AUR_USERNAME=ddev-releaser 21 AUR_REPO=$1 22 VERSION_NUMBER=$2 23 ARTIFACTS_DIR=$3 24 NO_V_VERSION=$(echo ${VERSION_NUMBER} | awk -F"-" '{ OFS="-"; sub(/^./, "", $1); printf $0; }') 25 LINUX_HASH=$(cat $ARTIFACTS_DIR/ddev_linux-amd64.${VERSION_NUMBER}.tar.gz.sha256.txt | awk '{print $1;}' ) 26 LINUX_TARBALL_URL=https://github.com/${GITHUB_USERNAME}/ddev/releases/download/${VERSION_NUMBER}/ddev_linux-amd64.${VERSION_NUMBER}.tar.gz 27 if [ ! -z "${LINUX_TARBALL_OVERRIDE:-}" ]; then 28 LINUX_TARBALL_URL=${LINUX_TARBALL_OVERRIDE} 29 LINUX_HASH=$(curl -sSL "${LINUX_TARBALL_URL}.sha256.txt" | awk '{print $1}') 30 fi 31 32 EDGE_DESCRIPTION="" 33 if [ ${AUR_REPO} = "ddev-edge-bin" ] ; then EDGE_DESCRIPTION=" (edge channel)"; fi 34 35 # Add temporary private key provided by CircleCI context 36 echo $AUR_SSH_PRIVATE_KEY | perl -p -e 's/<SPLIT>/\n/g' >/tmp/id_rsa_aur && chmod 600 /tmp/id_rsa_aur 37 38 eval $(ssh-agent) 39 ssh-add /tmp/id_rsa_aur 40 rm -rf ${AUR_REPO} 41 git config --global core.sshCommand 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' 42 git clone ssh://aur@aur.archlinux.org/${AUR_REPO}.git && pushd ${AUR_REPO} && touch .BUILDINFO && chmod -R ugo+w . 43 44 _name="ddev" 45 cat >PKGBUILD <<END 46 pkgname="${AUR_REPO}" 47 pkgver=$(echo ${VERSION_NUMBER} | tr '-' '_') 48 pkgrel=1 49 pkgdesc='DDEV: a local PHP development environment system${EDGE_DESCRIPTION}' 50 arch=('x86_64') 51 url='https://github.com/drud/ddev' 52 license=('Apache') 53 provides=("$_name") 54 conflicts=("$_name") 55 depends=('docker' 'docker-compose') 56 optdepends=('bash-completion: subcommand completion support') 57 source=("${LINUX_TARBALL_URL}") 58 sha256sums=("${LINUX_HASH}") 59 60 package() { 61 install -D -m 0755 ddev "\$pkgdir/usr/bin/ddev" 62 install -D -m 0644 ddev_bash_completion.sh "\$pkgdir/usr/share/bash-completion/completions/ddev" 63 install -D -m 0644 ddev_zsh_completion.sh "\$pkgdir/usr/share/zsh/site-functions/_ddev" 64 install -D -m 0644 ddev_fish_completion.sh "\$pkgdir/usr/share/fish/vendor_completions.d/ddev.fish" 65 } 66 END 67 68 docker run --rm --mount type=bind,source=$(pwd),target=/tmp/ddev-bin --workdir=/tmp/ddev-bin drud/arch-aur-builder bash -c "makepkg --printsrcinfo > .SRCINFO && makepkg -s" 69 70 git config user.email "randy+ddev-releaser@randyfay.com" 71 git config user.name "ddev-releaser" 72 73 git commit -am "AUR bump to ${VERSION_NUMBER}" 74 75 git push 76 popd