Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e66f869752 | ||
|
|
2c0f51422e |
@@ -105,16 +105,16 @@ jobs:
|
|||||||
VERSION="${{ github.event.inputs.tag || github.ref_name }}"
|
VERSION="${{ github.event.inputs.tag || github.ref_name }}"
|
||||||
PKGVER="${VERSION#v}"
|
PKGVER="${VERSION#v}"
|
||||||
|
|
||||||
# Source tarball — prefix=unitdore/ matches `cd "$pkgname"` in PKGBUILD
|
# Source archive — prefix=unitdore-vVERSION/ matches `cd "$pkgname-v$pkgver"` in PKGBUILD
|
||||||
git archive --format=tar.gz --prefix=unitdore/ HEAD \
|
git archive --format=zip --prefix=unitdore-v${PKGVER}/ HEAD \
|
||||||
> pkg/arch/unitdore-${PKGVER}.tar.gz
|
> pkg/arch/unitdore-${PKGVER}.zip
|
||||||
SHA=$(sha256sum pkg/arch/unitdore-${PKGVER}.tar.gz | cut -d' ' -f1)
|
SHA=$(sha256sum pkg/arch/unitdore-${PKGVER}.zip | cut -d' ' -f1)
|
||||||
|
|
||||||
# Patch PKGBUILD for local build
|
# Patch PKGBUILD for local build
|
||||||
sed -i \
|
sed -i \
|
||||||
-e "s/^pkgver=.*/pkgver=${PKGVER}/" \
|
-e "s/^pkgver=.*/pkgver=${PKGVER}/" \
|
||||||
-e "s/^sha256sums=.*/sha256sums=('${SHA}')/" \
|
-e "s/^sha256sums=.*/sha256sums=('${SHA}')/" \
|
||||||
-e "s|source=.*|source=(\"unitdore-\${pkgver}.tar.gz\")|" \
|
-e "s|source=.*|source=(\"unitdore-\${pkgver}.zip\")|" \
|
||||||
pkg/arch/PKGBUILD
|
pkg/arch/PKGBUILD
|
||||||
|
|
||||||
mkdir -p pkg/arch/out
|
mkdir -p pkg/arch/out
|
||||||
@@ -127,7 +127,7 @@ jobs:
|
|||||||
pacman -Syu --noconfirm base-devel go &&
|
pacman -Syu --noconfirm base-devel go &&
|
||||||
useradd -m builder &&
|
useradd -m builder &&
|
||||||
chown -R builder:builder /build &&
|
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/
|
cp /build/*.pkg.tar.zst /out/
|
||||||
"
|
"
|
||||||
|
|
||||||
@@ -148,6 +148,57 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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:
|
pkg-deb:
|
||||||
needs: release
|
needs: release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -232,11 +283,14 @@ jobs:
|
|||||||
-w /workspace \
|
-w /workspace \
|
||||||
rockylinux:9 \
|
rockylinux:9 \
|
||||||
bash -c "
|
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} &&
|
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} &&
|
||||||
cp unitdore-${PKGVER}.tar.gz ~/rpmbuild/SOURCES/ &&
|
cp unitdore-${PKGVER}.tar.gz ~/rpmbuild/SOURCES/ &&
|
||||||
cp pkg/centos/unitdore.spec ~/rpmbuild/SPECS/ &&
|
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/ \;
|
find ~/rpmbuild/RPMS -name '*.rpm' -exec cp {} /out/ \;
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,6 +1,6 @@
|
|||||||
module github.com/warkanum/unitdore
|
module github.com/warkanum/unitdore
|
||||||
|
|
||||||
go 1.26.1
|
go 1.23.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ pkgver=0.1.0
|
|||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="A door you open and close for container units — manage containers via systemd"
|
pkgdesc="A door you open and close for container units — manage containers via systemd"
|
||||||
arch=('x86_64' 'aarch64')
|
arch=('x86_64' 'aarch64')
|
||||||
url="https://warky.dev"
|
url="https://git.warky.dev/wdevs/unitdore"
|
||||||
license=('MIT')
|
license=('MIT')
|
||||||
depends=('systemd')
|
depends=('systemd')
|
||||||
optdepends=(
|
optdepends=(
|
||||||
@@ -13,11 +13,11 @@ optdepends=(
|
|||||||
)
|
)
|
||||||
makedepends=('go')
|
makedepends=('go')
|
||||||
backup=('etc/unitdore/units.yaml')
|
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')
|
sha256sums=('SKIP')
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "$pkgname"
|
cd "$pkgname-v$pkgver"
|
||||||
export CGO_ENABLED=0
|
export CGO_ENABLED=0
|
||||||
go build \
|
go build \
|
||||||
-trimpath \
|
-trimpath \
|
||||||
@@ -26,12 +26,12 @@ build() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
cd "$pkgname"
|
cd "$pkgname-v$pkgver"
|
||||||
go test ./...
|
go test ./...
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
cd "$pkgname"
|
cd "$pkgname-v$pkgver"
|
||||||
|
|
||||||
# Binary
|
# Binary
|
||||||
install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
|
install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ Release: 1%{?dist}
|
|||||||
Summary: Manage container units via systemd
|
Summary: Manage container units via systemd
|
||||||
|
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://warky.dev
|
URL: https://git.warky.dev/wdevs/unitdore
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
|
|
||||||
BuildRequires: golang >= 1.21
|
BuildRequires: golang >= 1.23
|
||||||
Requires: systemd
|
Requires: systemd
|
||||||
|
|
||||||
%description
|
%description
|
||||||
|
|||||||
Reference in New Issue
Block a user