From b9fb40bf965a0de31f5099523f05f37af391efc6 Mon Sep 17 00:00:00 2001 From: niklascfw Date: Mon, 13 Apr 2026 19:03:33 +0200 Subject: [PATCH] CI: Gitea checkout without GitHub; workflow_dispatch + daily schedule (UTC) Made-with: Cursor --- .github/workflows/build-and-release.yml | 26 +++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 84f6969..47ee165 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -1,7 +1,10 @@ name: Build and Release on: - push: + workflow_dispatch: + schedule: + # Midnight UTC every day (Actions cron is UTC). For local midnight, shift hours, e.g. 22:00 UTC ≈ midnight CET (winter). + - cron: "0 0 * * *" concurrency: group: nightly-release-${{ github.repository }} @@ -15,8 +18,27 @@ jobs: contents: write steps: + # Clone from Gitea (this runner cannot reach github.com for actions/checkout@v4) - name: Checkout repository - uses: actions/checkout@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + cd "${GITHUB_WORKSPACE}" + SERVER="${{ github.server_url }}" + REPO="${{ github.repository }}" + SHA="${{ github.sha }}" + HOST="${SERVER#*://}" + HOST="${HOST%%/*}" + if [ -n "${GITHUB_TOKEN:-}" ]; then + URL="https://oauth2:${GITHUB_TOKEN}@${HOST}/${REPO}.git" + else + URL="${SERVER}/${REPO}.git" + fi + git init + git remote add origin "$URL" + git fetch --depth 1 origin "$SHA" + git checkout --force FETCH_HEAD - name: Set up build tools run: |