# Copyright 2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # The Gitea Actions runner (formerly act_runner): a Go daemon that # registers with a Gitea instance and executes CI workflow jobs, normally # in containers via the Docker daemon. Its fork of the act workflow engine # is vendored in-tree by upstream, so the Go module cache tarball covers # every dependency. # # Unslotted again since the runner hosts moved to throwaway template VMs # (dev-util/gitea-oneshot-runner): only the latest version ships. EAPI=8 inherit go-module systemd # The Go dependency tarball lives as a release asset on this repository, # tagged gitea-runner-v. GITEA_RUNNER_DISTFILES="https://git.ipnmod.org/packages/local-ai-overlay/releases/download/gitea-runner-v${PV}" DESCRIPTION="Daemon that connects to a Gitea instance and runs CI action jobs" HOMEPAGE="https://gitea.com/gitea/runner" SRC_URI=" ${GITEA_RUNNER_DISTFILES}/${P}.tar.gz ${GITEA_RUNNER_DISTFILES}/${P}-deps.tar.xz " # Gitea archives extract to the bare repository name. S="${WORKDIR}/runner" LICENSE="MIT" SLOT="0" KEYWORDS="~amd64" # Since 5.0 the runner fetches actions and reusable workflows over git # itself instead of through the act engine, so git becomes a runtime # requirement on the runner host (upstream floor: 2.34.1). RDEPEND=" acct-group/gitea-runner acct-user/gitea-runner >=dev-vcs/git-2.34.1 " BDEPEND=">=dev-lang/go-1.27.3" src_prepare() { default einfo "Pointing the systemd unit at the packaged binary path" sed -i "s#/usr/local/bin/gitea-runner#/usr/bin/gitea-runner#" examples/systemd/gitea-runner.service || die grep -q "/usr/bin/gitea-runner" examples/systemd/gitea-runner.service || die "unit path fix did not apply" } src_compile() { # Version stamped the same way upstream's release builds do it. # Upstream's Makefile also adds -s -w; leave stripping to Portage # instead (it would flag the binary as pre-stripped otherwise). local ldflags=( -X "gitea.com/gitea/runner/internal/pkg/ver.version=v${PV}" ) ego build -ldflags "${ldflags[*]}" -o gitea-runner # The default configuration file, generated by the freshly built # binary so it always matches this version's options. ./gitea-runner generate-config > config.yaml || die } src_install() { dobin gitea-runner insinto /etc/gitea-runner doins config.yaml newinitd "${FILESDIR}"/gitea-runner.initd gitea-runner newconfd "${FILESDIR}"/gitea-runner.confd gitea-runner systemd_newunit examples/systemd/gitea-runner.service gitea-runner.service insinto /etc/logrotate.d newins "${FILESDIR}"/gitea-runner.logrotate gitea-runner # The .runner registration file and job workspaces. keepdir /var/lib/gitea-runner fowners gitea-runner:gitea-runner /var/lib/gitea-runner } pkg_postinst() { elog "Register the runner before first start (as the service user, so" elog "the registration lands in the working directory):" elog " su -s /bin/sh gitea-runner -c 'cd /var/lib/gitea-runner && \\" elog " gitea-runner register --config /etc/gitea-runner/config.yaml'" elog "Then adjust /etc/gitea-runner/config.yaml and start the" elog "gitea-runner service." elog elog "Coming from a slotted install (gitea-runner-): the" elog "registration keeps its identity when its file moves," elog " mv /var/lib/gitea-runner-6/.runner /var/lib/gitea-runner/" elog "then swap gitea-runner-6 for gitea-runner in the runlevel." ewarn "6.0 removes the builtin:checkout action: a workflow step that uses" ewarn "it fails until it is changed to actions/checkout (or another" ewarn "checkout action)." }