Files
sci/.sci.sh
T
agj 80857e0f0a wip: fix existing todos
Co-authored-by: Github CoPilot
2026-06-16 22:48:04 +02:00

56 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
set -e
echo ">>> checking if required environment is set..."
test -n "$DOCKER_TOKEN"
: "${PACKAGE_REGISTRY_USER:=agj}"
export PACKAGE_REGISTRY_USER
which make
echo ">>> compiling..."
make
export VERSION=$(./out/bin/sci -V)
echo ">>> building source dist..."
make dist
SRC_SHA256=$(sha256sum "sci-${VERSION}.tar.gz" | awk '{ print $1 }')
sed "s/SRC_SHA256/${SRC_SHA256}/g" < PKGBUILD.in > PKGBUILD
# # arch
echo ">>> building archbuilder image..."
docker build -t archbuilder -f arch-builder.dockerfile .
echo ">>> building arch package in archbuilder docker image..."
docker run --rm -it -v .:/src -e VERSION archbuilder sh -c '\
cd && \
cp /src/sci-$VERSION.tar.gz /src/PKGBUILD . && \
makepkg && \
cp *.zst /src
'
# debian
echo ">>> building debbuilder image..."
docker build -t debbuilder -f deb-builder.dockerfile .
echo ">>> building .deb in debbuilder docker image..."
docker run --rm -it -v .:/src -e VERSION -e DOCKER_TOKEN -e PACKAGE_REGISTRY_USER debbuilder sh -c '\
cd && \
mkdir -p artifacts && \
cp /src/sci-$VERSION.tar.gz . && \
mv sci-$VERSION.tar.gz sci_$VERSION.orig.tar.gz && \
tar xf sci_$VERSION.orig.tar.gz && \
cd sci-$VERSION && \
cp -r /src/debian . && \
debuild && \
cp ../*.deb ~/artifacts && \
cp ../*.dsc ~/artifacts && \
cp ../*.build ~/artifacts && \
cp ../*.buildinfo ~/artifacts && \
cp ../*.changes ~/artifacts && \
cp ../*.tar.xz ~/artifacts && \
cp ../*.tar.gz ~/artifacts && \
cd && \
curl --user "$PACKAGE_REGISTRY_USER:$DOCKER_TOKEN" \
--upload-file sci_$VERSION-1_amd64.deb \
"https://git.gtz.dk/api/packages/agj/debian/pool/bionic/main/upload"
'