[Buildkite] Automate CD for AUR packages (#644)

* [Buildkite] Automate continuous deployment for AUR packages

* [Buildkite] Make AUR deploy step conditional
pull/645/head
Amir Zarrinkafsh 2020-02-20 10:25:28 +11:00 committed by GitHub
parent d80becc343
commit 447b2461e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 3 deletions

View File

@ -17,4 +17,9 @@ steps:
command: ".buildkite/steps/ghartifacts.sh"
agents:
upload: "fast"
if: build.tag != null
key: "artifacts"
if: build.tag != null
- label: ":linux: Deploy AUR"
command: ".buildkite/steps/aurpackages.sh | buildkite-agent pipeline upload"
if: build.tag != null || build.branch == "master"

View File

@ -0,0 +1,23 @@
#! /bin/bash
GITTAG=$(git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g')
echo "--- :linux: Deploy AUR package: ${PACKAGE}"
git clone ssh://aur@aur.archlinux.org/"${PACKAGE}".git
cd "${PACKAGE}" || exit
if [[ $PACKAGE != "authelia-git" ]]; then
sed -i "/pkgver=/c\pkgver=${BUILDKITE_TAG//v/}" PKGBUILD && \
docker run --rm -v $PWD:/build authelia/aurpackager bash -c "cd /build && updpkgsums"
else
sed -i "/pkgver=/c\pkgver=${GITTAG}" PKGBUILD
fi
docker run --rm -v $PWD:/build authelia/aurpackager bash -c "cd /build && makepkg --printsrcinfo >| .SRCINFO" && \
git add . && \
if [[ $PACKAGE != "authelia-git" ]]; then
git commit -m "Update to ${BUILDKITE_TAG}"
else
git commit -m "Update to GIT version: ${GITTAG}"
fi
git push

View File

@ -0,0 +1,20 @@
#!/bin/bash
set -eu
for AUR_PACKAGE in authelia authelia-bin authelia-git;
do
echo " - label: \":linux: Deploy AUR Package [${AUR_PACKAGE}]\""
echo " commands:"
echo " - \"aurhelper.sh\""
echo " agents:"
echo " upload: \"fast\""
echo " env:"
echo " "PACKAGE: ${AUR_PACKAGE}""
if [[ "${AUR_PACKAGE}" != "authelia-git" ]]; then
echo " depends_on:"
echo " - \"artifacts\""
echo " if: build.tag != null"
else
echo " if: build.branch == \"master\""
fi
done

View File

@ -7,7 +7,7 @@ do
echo " - \"authelia-scripts docker push-image --arch=${BUILD_ARCH}\""
echo " label: \":docker: Deploy Image [${BUILD_ARCH}]\""
echo " agents:"
echo " "upload: fast""
echo " upload: \"fast\""
echo " env:"
echo " "ARCH: ${BUILD_ARCH}""
done

View File

@ -1,6 +1,6 @@
#!/bin/bash
export PATH=$PATH:./cmd/authelia-scripts/:./node_modules/.bin:/tmp
export PATH=$PATH:./cmd/authelia-scripts/:./.buildkite/steps/:./node_modules/.bin:/tmp
if [[ -z "$OLD_PS1" ]]; then
OLD_PS1="$PS1"