commit 0c8eebbeb9dd01600d4f6789d28f1545e9306f80 Author: JMARyA Date: Fri Dec 27 09:03:11 2024 +0100 init diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml new file mode 100644 index 0000000..000ec50 --- /dev/null +++ b/.woodpecker/build.yml @@ -0,0 +1,15 @@ +when: + - event: push + branch: main + +steps: + - name: build + image: woodpeckerci/plugin-docker-buildx + settings: + platforms: linux/amd64 + repo: git.hydrar.de/jmarya/pacco-build + registry: git.hydrar.de + tags: latest + username: jmarya + password: + from_secret: registry_token diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ac18322 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM archlinux + +RUN pacman -Syu --noconfirm base-devel pacman + +COPY src/buildpkg /usr/bin/buildpkg +COPY src/makepkgsigned /usr/bin/makepkgsigned +RUN chmod +x /usr/bin/buildpkg +RUN chmod +x /usr/bin/makepkgsigned diff --git a/README.md b/README.md new file mode 100644 index 0000000..dd139c7 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# pacco-build +Build Container for PKGBUILDs with auto push to pacco. + +## Usage +Add the following to your repos `.woodpecker` jobs: + +```yml +when: + - event: push + branch: main + +steps: + - name: "PKGBUILD" + image: git.hydrar.de/jmarya/pacco-build:latest + commands: + - buildpkg +``` + +Where: +- ``: Name of the repo you want to push to +- ``: Architecture you are building for +- ``: Domain of your pacco instance +- ``: Token of your user +- ``: GPG key used to sign the package diff --git a/src/buildpkg b/src/buildpkg new file mode 100644 index 0000000..c6626fb --- /dev/null +++ b/src/buildpkg @@ -0,0 +1,24 @@ +#!/bin/bash + +# Usage: buildpkg + +# Setup package user +useradd -m pkgbuild +passwd -d pkgbuild +echo "pkgbuild ALL=(ALL) NOPASSWD: /usr/bin/pacman" >> /etc/sudoers +chown -R pkgbuild:pkgbuild . + +# Build package +su - pkgbuild -c "cd $(pwd);/usr/bin/makepkgsigned \"$5\"11" + +source PKGBUILD + +# Push package to pacco +curl -X POST \ +-F "pkg=@./$pkgname-$pkgver-$pkgrel-$2.pkg.tar.zst" \ +-F "sig=@./$pkgname-$pkgver-$pkgrel-$2.pkg.tar.zst.sig" \ +-F "name=$pkgname" \ +-F "arch=$2" \ +-F "version=$pkgver" \ +-H "Token: $4" \ +"https://$3/pkg/$1/upload" diff --git a/src/makepkgsigned b/src/makepkgsigned new file mode 100644 index 0000000..69c168c --- /dev/null +++ b/src/makepkgsigned @@ -0,0 +1,6 @@ +#!/bin/bash + +# Setup signing key +echo -e $1|gpg --import +export GPGKEY=$(echo -e $1|gpg --with-colons --import-options show-only --import --fingerprint|awk -F: '$1 == "fpr" {print $10;}'|head -n1) +makepkg -s --sign --noconfirm