package-pipelines-miscellan.../ansible-semaphore/build.sh
s3lph 320c66b4a0
Some checks failed
/ ansible-semaphore (push) Successful in 2m32s
/ atlasswprobe (push) Successful in 7m41s
/ daliserver (push) Successful in 1m55s
/ forgejo (push) Successful in 5m54s
/ forgejo-runner (push) Successful in 1m24s
/ http-mqtt-bridge (push) Successful in 4m15s
/ keycloak-24 (push) Successful in 4m30s
/ keycloak-25 (push) Successful in 7m31s
/ linux-diversion-ath-regd-optional (push) Successful in 12m23s
/ lottieconverter (push) Successful in 57s
/ matterbridge (push) Successful in 2m22s
/ matrix-element-web (push) Successful in 3m54s
/ matrix-hydrogen (push) Successful in 1m18s
/ matrix.to (push) Successful in 5m41s
/ maubot (push) Successful in 5m11s
/ maubot-plugin-spaceapi (push) Successful in 2m1s
/ maubot-plugin-ultimaker (push) Successful in 1m45s
/ mautrix-signal (push) Successful in 1m22s
/ mautrix-telegram (push) Successful in 1m18s
/ mediawiki-extension-auth-remoteuser (push) Successful in 1m19s
/ mediawiki-extension-openidconnect (push) Successful in 1m23s
/ mqtt2prometheus (push) Successful in 4m26s
/ prometheus-ipmi-exporter (push) Successful in 2m13s
/ prometheus-dnsbl-exporter (push) Successful in 1m45s
/ prometheus2influxdb (push) Successful in 59s
/ python3-mautrix (push) Successful in 1m17s
/ python3-telethon (push) Successful in 1m26s
/ repo.s3lph.me-apt-source (push) Successful in 1m1s
/ republik-feeder (push) Successful in 1m16s
/ woodpecker-agent (push) Successful in 2m15s
/ woodpecker-cli (push) Successful in 1m42s
/ mediawiki-extension-nativesvghandler (push) Failing after 13m23s
/ mediawiki-extension-pluggableauth (push) Failing after 13m1s
fix(ansible-semaphore): github changelog reponame
2024-07-18 22:03:57 +02:00

65 lines
2.3 KiB
Bash
Executable file

#!/bin/bash
set -exo pipefail
. ../.skel/helpers.sh
PKGNAME=ansible-semaphore
API_URL=https://api.github.com/repos/semaphoreui/semaphore/releases
JQ_EXPR='.[] | select( .prerelease==false and .draft==false and (.tag_name|test("^v[0-9.-]+$")) ) | "\(.name[1:]) \(.published_at) \(.assets[] | select(.name|test(".*_linux_amd64.tar.gz$")).browser_download_url )"'
ROOT=$(pwd)
function fetch() {
cd "${SRCDIR}"
wget "${URL}" --output-document "semaphore_${VERSION}_linux_amd64.tar.gz"
tar xf "semaphore_${VERSION}_linux_amd64.tar.gz"
}
function prepare() {
chmod +x "${SRCDIR}/semaphore"
mkdir -p \
"${PKGDIR}/DEBIAN" \
"${PKGDIR}/usr/bin" \
"${PKGDIR}/etc/semaphore" \
"${PKGDIR}/var/lib/semaphore/playbooks" \
"${PKGDIR}/var/lib/semaphore/database" \
"${PKGDIR}/lib/systemd/system" \
"${PKGDIR}/usr/share/doc/${PKGNAME}"
cp "${SRCDIR}/semaphore" "${PKGDIR}/usr/bin/semaphore"
cp "${ROOT}/semaphore.service" "${PKGDIR}/lib/systemd/system/semaphore.service"
cp "${ROOT}/debian.control" "${PKGDIR}/DEBIAN/control"
cp "${ROOT}/debian.conffiles" "${PKGDIR}/DEBIAN/conffiles"
cp "${ROOT}/debian.postinst" "${PKGDIR}/DEBIAN/postinst"
cp "${ROOT}/debian.prerm" "${PKGDIR}/DEBIAN/prerm"
cp "${ROOT}/debian.postrm" "${PKGDIR}/DEBIAN/postrm"
cp "${ROOT}/config.json" "${PKGDIR}/etc/semaphore/config.json"
sed -re "s/__VERSION__/${VERSION}/g" -i "${PKGDIR}/DEBIAN/control"
sed -re "s/__MAINTAINER__/${MAINTAINER}/g" -i "${PKGDIR}/DEBIAN/control"
cp "${SRCDIR}/LICENSE" "${PKGDIR}/usr/share/doc/${PKGNAME}/copyright"
github_changelog semaphoreui/semaphore
find "${PKGDIR}" -exec touch -m -d "${ISODATE}" {} \;
}
function package() {
cd "${BUILDDIR}"
dpkg-deb --build "${PKGDIR}" "${BUILDDIR}"
}
function build() {
read VERSION ISODATE URL <<<$(curl "${API_URL}" | jq -r "${JQ_EXPR}" | head -1)
# Replace Forgejo patch level separater - with . to be Debian versioning compatible, and add epoch number 2
export VERSION="${VERSION/-/.}"
export ISODATE
export URL
export BUILDDIR=${ROOT}/build
export SRCDIR=${ROOT}/build/srcdir
export PKGDIR=${ROOT}/build/pkgdir
mkdir -p ${SRCDIR} ${PKGDIR}
fetch
prepare
package
}
build