This commit is contained in:
commit
0c8eebbeb9
5 changed files with 77 additions and 0 deletions
15
.woodpecker/build.yml
Normal file
15
.woodpecker/build.yml
Normal file
|
@ -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
|
8
Dockerfile
Normal file
8
Dockerfile
Normal file
|
@ -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
|
24
README.md
Normal file
24
README.md
Normal file
|
@ -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 <repo> <arch> <domain> <token> <gpg_key>
|
||||
```
|
||||
|
||||
Where:
|
||||
- `<repo>`: Name of the repo you want to push to
|
||||
- `<arch>`: Architecture you are building for
|
||||
- `<domain>`: Domain of your pacco instance
|
||||
- `<token>`: Token of your user
|
||||
- `<gpg_key>`: GPG key used to sign the package
|
24
src/buildpkg
Normal file
24
src/buildpkg
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Usage: buildpkg <REPO> <ARCH> <DOMAIN> <TOKEN> <PGP_KEY>
|
||||
|
||||
# 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"
|
6
src/makepkgsigned
Normal file
6
src/makepkgsigned
Normal file
|
@ -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
|
Loading…
Reference in a new issue