Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e66f869752 | ||
|
|
2c0f51422e |
@@ -105,16 +105,16 @@ jobs:
|
||||
VERSION="${{ github.event.inputs.tag || github.ref_name }}"
|
||||
PKGVER="${VERSION#v}"
|
||||
|
||||
# Source tarball — prefix=unitdore/ matches `cd "$pkgname"` in PKGBUILD
|
||||
git archive --format=tar.gz --prefix=unitdore/ HEAD \
|
||||
> pkg/arch/unitdore-${PKGVER}.tar.gz
|
||||
SHA=$(sha256sum pkg/arch/unitdore-${PKGVER}.tar.gz | cut -d' ' -f1)
|
||||
# Source archive — prefix=unitdore-vVERSION/ matches `cd "$pkgname-v$pkgver"` in PKGBUILD
|
||||
git archive --format=zip --prefix=unitdore-v${PKGVER}/ HEAD \
|
||||
> pkg/arch/unitdore-${PKGVER}.zip
|
||||
SHA=$(sha256sum pkg/arch/unitdore-${PKGVER}.zip | cut -d' ' -f1)
|
||||
|
||||
# Patch PKGBUILD for local build
|
||||
sed -i \
|
||||
-e "s/^pkgver=.*/pkgver=${PKGVER}/" \
|
||||
-e "s/^sha256sums=.*/sha256sums=('${SHA}')/" \
|
||||
-e "s|source=.*|source=(\"unitdore-\${pkgver}.tar.gz\")|" \
|
||||
-e "s|source=.*|source=(\"unitdore-\${pkgver}.zip\")|" \
|
||||
pkg/arch/PKGBUILD
|
||||
|
||||
mkdir -p pkg/arch/out
|
||||
@@ -127,7 +127,7 @@ jobs:
|
||||
pacman -Syu --noconfirm base-devel go &&
|
||||
useradd -m builder &&
|
||||
chown -R builder:builder /build &&
|
||||
runuser -u builder -- makepkg --noconfirm --noprogressbar &&
|
||||
runuser -u builder -- bash -c 'cd /build && makepkg --noconfirm --noprogressbar' &&
|
||||
cp /build/*.pkg.tar.zst /out/
|
||||
"
|
||||
|
||||
@@ -148,6 +148,57 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
pkg-aur:
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Publish to AUR
|
||||
env:
|
||||
AUR_SSH_KEY: ${{ secrets.AUR_SSH_KEY }}
|
||||
run: |
|
||||
VERSION="${{ github.event.inputs.tag || github.ref_name }}"
|
||||
PKGVER="${VERSION#v}"
|
||||
|
||||
# Setup SSH for AUR
|
||||
mkdir -p ~/.ssh
|
||||
echo "$AUR_SSH_KEY" > ~/.ssh/aur
|
||||
chmod 600 ~/.ssh/aur
|
||||
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
|
||||
|
||||
# Clone AUR repo
|
||||
GIT_SSH_COMMAND="ssh -i ~/.ssh/aur" git clone ssh://aur@aur.archlinux.org/unitdore.git aur-repo
|
||||
|
||||
# Compute SHA256 of the release tarball (same URL the PKGBUILD will download)
|
||||
SHA=$(curl -fsSL "https://git.warky.dev/wdevs/unitdore/archive/v${PKGVER}.zip" | sha256sum | cut -d' ' -f1)
|
||||
|
||||
# Update PKGBUILD — keep remote source URL, only bump version and checksum
|
||||
sed -e "s/^pkgver=.*/pkgver=${PKGVER}/" \
|
||||
-e "s/^pkgrel=.*/pkgrel=1/" \
|
||||
-e "s/^sha256sums=.*/sha256sums=('${SHA}')/" \
|
||||
pkg/arch/PKGBUILD > aur-repo/PKGBUILD
|
||||
|
||||
# Generate .SRCINFO inside an Arch container
|
||||
docker run --rm \
|
||||
-v "$PWD/aur-repo:/build" \
|
||||
-w /build \
|
||||
archlinux:latest \
|
||||
bash -c "
|
||||
pacman -Sy --noconfirm base-devel &&
|
||||
useradd -m builder &&
|
||||
chown -R builder:builder /build &&
|
||||
runuser -u builder -- bash -c 'cd /build && makepkg --printsrcinfo > .SRCINFO'
|
||||
"
|
||||
|
||||
# Commit and push to AUR master
|
||||
cd aur-repo
|
||||
git config user.email "hein@warky.dev"
|
||||
git config user.name "Hein"
|
||||
git add PKGBUILD .SRCINFO
|
||||
git commit -m "Update to v${PKGVER}"
|
||||
GIT_SSH_COMMAND="ssh -i ~/.ssh/aur" git push origin HEAD:master
|
||||
|
||||
pkg-deb:
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
@@ -232,11 +283,14 @@ jobs:
|
||||
-w /workspace \
|
||||
rockylinux:9 \
|
||||
bash -c "
|
||||
dnf install -y rpm-build golang git &&
|
||||
dnf install -y rpm-build git curl &&
|
||||
GO_VER=\$(grep '^go ' /workspace/go.mod | awk '{print \$2}') &&
|
||||
curl -fsSL https://go.dev/dl/go\${GO_VER}.linux-amd64.tar.gz | tar -C /usr/local -xz &&
|
||||
export PATH=\$PATH:/usr/local/go/bin &&
|
||||
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} &&
|
||||
cp unitdore-${PKGVER}.tar.gz ~/rpmbuild/SOURCES/ &&
|
||||
cp pkg/centos/unitdore.spec ~/rpmbuild/SPECS/ &&
|
||||
rpmbuild -ba ~/rpmbuild/SPECS/unitdore.spec &&
|
||||
rpmbuild --nodeps -ba ~/rpmbuild/SPECS/unitdore.spec &&
|
||||
find ~/rpmbuild/RPMS -name '*.rpm' -exec cp {} /out/ \;
|
||||
"
|
||||
|
||||
|
||||
2
go.mod
2
go.mod
@@ -1,6 +1,6 @@
|
||||
module github.com/warkanum/unitdore
|
||||
|
||||
go 1.26.1
|
||||
go 1.23.0
|
||||
|
||||
require (
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
|
||||
@@ -4,7 +4,7 @@ pkgver=0.1.0
|
||||
pkgrel=1
|
||||
pkgdesc="A door you open and close for container units — manage containers via systemd"
|
||||
arch=('x86_64' 'aarch64')
|
||||
url="https://warky.dev"
|
||||
url="https://git.warky.dev/wdevs/unitdore"
|
||||
license=('MIT')
|
||||
depends=('systemd')
|
||||
optdepends=(
|
||||
@@ -13,11 +13,11 @@ optdepends=(
|
||||
)
|
||||
makedepends=('go')
|
||||
backup=('etc/unitdore/units.yaml')
|
||||
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
|
||||
source=("$pkgname-$pkgver.zip::$url/archive/v$pkgver.zip")
|
||||
sha256sums=('SKIP')
|
||||
|
||||
build() {
|
||||
cd "$pkgname"
|
||||
cd "$pkgname-v$pkgver"
|
||||
export CGO_ENABLED=0
|
||||
go build \
|
||||
-trimpath \
|
||||
@@ -26,12 +26,12 @@ build() {
|
||||
}
|
||||
|
||||
check() {
|
||||
cd "$pkgname"
|
||||
cd "$pkgname-v$pkgver"
|
||||
go test ./...
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$pkgname"
|
||||
cd "$pkgname-v$pkgver"
|
||||
|
||||
# Binary
|
||||
install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
|
||||
|
||||
@@ -4,10 +4,10 @@ Release: 1%{?dist}
|
||||
Summary: Manage container units via systemd
|
||||
|
||||
License: MIT
|
||||
URL: https://warky.dev
|
||||
URL: https://git.warky.dev/wdevs/unitdore
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
|
||||
BuildRequires: golang >= 1.21
|
||||
BuildRequires: golang >= 1.23
|
||||
Requires: systemd
|
||||
|
||||
%description
|
||||
|
||||
Reference in New Issue
Block a user