commit 3af909d34859bf77c49f5aa020504467a6f2b267 Author: Davide Depau Date: Fri Apr 17 07:46:05 2020 +0200 Initial commit diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..8db03bc --- /dev/null +++ b/.drone.yml @@ -0,0 +1,47 @@ +--- +kind: pipeline +type: docker +name: alarm-aarch64 + +platform: + os: linux + arch: arm64 + +steps: + - name: build-image + image: plugins/docker + environment: + TZ: Europe/Rome + settings: + dockerfile: Dockerfile.aarch64 + purge: true + username: depau + password: + from_secret: docker_password + repo: depau/drone-makepkg + tags: + - aarch64 + +--- +kind: pipeline +type: docker +name: archlinux-x86_64 + +platform: + os: linux + arch: amd64 + +steps: + - name: build-image + image: plugins/docker + environment: + TZ: Europe/Rome + settings: + dockerfile: Dockerfile.x86_64 + purge: true + username: depau + password: + from_secret: docker_password + repo: depau/drone-makepkg + tags: + - x86_64 diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 new file mode 100644 index 0000000..b6a5ae8 --- /dev/null +++ b/Dockerfile.aarch64 @@ -0,0 +1,7 @@ +FROM depau/archlinux-makepkg:aarch64 + +USER root +COPY makepkg.sh /usr/local/bin/drone-makepkg +USER builder + +ENTRYPOINT ["drone-makepkg"] diff --git a/Dockerfile.x86_64 b/Dockerfile.x86_64 new file mode 100644 index 0000000..055ab78 --- /dev/null +++ b/Dockerfile.x86_64 @@ -0,0 +1,7 @@ +FROM depau/archlinux-makepkg:x86_64 + +USER root +COPY makepkg.sh /usr/local/bin/drone-makepkg +USER builder + +ENTRYPOINT ["drone-makepkg"] diff --git a/makepkg.sh b/makepkg.sh new file mode 100644 index 0000000..7c315d9 --- /dev/null +++ b/makepkg.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +set -e + +echo "Building on: $DRONE_STAGE_MACHINE" + +AUR_URL="https://aur.archlinux.org" +OUTDIR="$DRONE_WORKSPACE_BASE/out" +mkdir -p "$OUTDIR" + +if [ "$PLUGIN_AUTO_MAKEFLAGS" != "no" ]; then + echo "MAKEFLAGS='-j$(nproc)'" | sudo tee -a /etc/makepkg.conf +fi + +if [ "$PLUGIN_INSTALL" != "" ]; then + echo "Installing packages before build: $PLUGIN_INSTALL" + pikaur -Syu --noprogressbar --noconfirm $(echo "$PLUGIN_INSTALL" | tr ',' ' ') +fi + +if [ "$PLUGIN_INSTALL_OUTPUTS" != "no" ] && [ -n "$(ls -A "$OUTDIR")" ]; then + echo "Installing previous build outputs" + pikaur -U --noprogressbar --noconfirm "$OUTDIR"/* +fi + +# Clone package repo +if [ "$PLUGIN_AUR" != "" ]; then + echo "Building AUR package $PLUGIN_AUR" + git clone "$AUR_URL/$PLUGIN_AUR.git" package + cd package +elif [ "$PLUGIN_REPO" != "" ]; then + echo "Building package from git repository: $PLUGIN_REPO" + git clone "$PLUGIN_REPO" package + cd package +else + echo "Building source repository" +fi + +PKGBUILD="PKGBUILD" +if [ "$PLUGIN_PKGBUILD" != "" ]; then + echo "Using PKGBUILD: $PLUGIN_PKGBUILD" + PKGBUILD="$PLUGIN_PKGBUILD" +fi + +echo "Running build" +pikaur --noprogressbar --noconfirm -P "$PKGBUILD" + +echo "Moving packages to output directory: $OUTDIR" +mv *.pkg.* "$OUTDIR/"