From e1cc47ff70f50a5cd9db63761f0c705f8b51bf03 Mon Sep 17 00:00:00 2001 From: Florian Date: Mon, 19 Oct 2026 09:38:54 +0200 Subject: [PATCH] Building on server --- .gitea/workflows/gitea-runner-release.yaml | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .gitea/workflows/gitea-runner-release.yaml diff --git a/.gitea/workflows/gitea-runner-release.yaml b/.gitea/workflows/gitea-runner-release.yaml new file mode 100644 index 0000000..a242e7f --- /dev/null +++ b/.gitea/workflows/gitea-runner-release.yaml @@ -0,0 +1,72 @@ +name: Build and publish gitea-runner + +on: + workflow_dispatch: + inputs: + version: + description: "Upstream version, without the v (e.g. 5.1.1)" + required: true + type: string + revision: + description: "Packaging revision" + required: false + default: "1" + type: string + +env: + DISTRIBUTION: any + COMPONENT: main + +jobs: + build-and-publish: + runs-on: ubuntu-latest + steps: + - name: Validate inputs + env: + VERSION: ${{ inputs.version }} + REVISION: ${{ inputs.revision }} + run: | + # Inputs may come from an external service, so never trust them blindly + echo "$VERSION" | grep -Eq '^[0-9]+(\.[0-9]+)*$' || { echo "Bad version"; exit 1; } + echo "$REVISION" | grep -Eq '^[0-9]+$' || { echo "Bad revision"; exit 1; } + + - uses: actions/checkout@v4 + + - name: Install build tools + run: | + if ! command -v make >/dev/null || ! command -v curl >/dev/null; then + apt-get update && apt-get install -y make curl + fi + + - name: Build package + env: + VERSION: ${{ inputs.version }} + REVISION: ${{ inputs.revision }} + run: make VERSION="$VERSION" REVISION="$REVISION" + + - name: Publish to Gitea package registry + env: + VERSION: ${{ inputs.version }} + REVISION: ${{ inputs.revision }} + UPLOADER: ${{ secrets.PACKAGE_UPLOAD_USERNAME }} + TOKEN: ${{ secrets.PACKAGE_UPLOAD_TOKEN }} + OWNER: ${{ gitea.repository_owner }} + SERVER: ${{ gitea.server_url }} + run: | + DEB="build/gitea-runner_${VERSION}-${REVISION}_amd64.deb" + CODE=$(curl -sS -o /tmp/resp -w '%{http_code}' \ + --user "${UPLOADER}:${TOKEN}" \ + --upload-file "$DEB" \ + "${SERVER}/api/packages/${OWNER}/debian/pool/${DISTRIBUTION}/${COMPONENT}/upload") + cat /tmp/resp; echo + case "$CODE" in + 201) echo "Published $DEB" ;; + 409) echo "This version/revision already exists; bump REVISION"; exit 1 ;; + *) echo "Upload failed with HTTP $CODE"; exit 1 ;; + esac + + - name: Keep the .deb as a workflow artifact + uses: actions/upload-artifact@v3 + with: + name: gitea-runner-deb + path: build/*.deb \ No newline at end of file