From f1ab8059b0455035ba35f918a37cb17e5d980d95 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 14 May 2026 19:50:01 +0200 Subject: [PATCH] Push runner release repository after build --- README.md | 4 +--- build.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 187dbe9..87edd82 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,7 @@ or: GITEA_RUNNER_VERSION=1.0.2 ./build.sh ``` -The script downloads the Linux `amd64` and `arm64` release artifacts, verifies their SHA256 checksums, builds `.deb` packages, moves them into `../gitea-runner-deb`, regenerates `Packages`, `Packages.gz`, and `Release`, then commits the release repo changes locally. - -It does not push either repository. +The script downloads the Linux `amd64` and `arm64` release artifacts, verifies their SHA256 checksums, builds `.deb` packages, moves them into `../gitea-runner-deb`, regenerates `Packages`, `Packages.gz`, and `Release`, commits the release repo changes, then pushes the release repo branch to `origin`. ## Systemd Timer diff --git a/build.sh b/build.sh index 27c7147..68dbddc 100755 --- a/build.sh +++ b/build.sh @@ -6,6 +6,22 @@ BINARY_NAME="gitea-runner" DOWNLOAD_NAME="gitea-runner" RELEASE_REPO="../gitea-runner-deb" +publish_release_repo() { + ( + cd "${RELEASE_REPO}" + + local branch + branch=$(git rev-parse --abbrev-ref HEAD) + if [[ "$branch" == "HEAD" ]]; then + echo "Release repo is in detached HEAD state; cannot push automatically." >&2 + exit 1 + fi + + echo "Pushing release repo ${branch} ..." + git push origin "${branch}" + ) +} + resolve_version() { if [[ -n "${1:-}" ]]; then VERSION_SOURCE="command line argument" @@ -66,6 +82,7 @@ done if [[ -f "${RELEASE_REPO}/${PACKAGE_NAME}_${VERSION}_amd64.deb" ]] && [[ -f "${RELEASE_REPO}/${PACKAGE_NAME}_${VERSION}_arm64.deb" ]]; then echo "SKIP: Version ${VERSION} already built and present in release repo." + publish_release_repo exit 0 fi @@ -135,3 +152,5 @@ mv "${PACKAGE_NAME}_${VERSION}_"*.deb "${RELEASE_REPO}/" echo "No changes to commit." fi ) + +publish_release_repo