CI: Gitea checkout without GitHub; workflow_dispatch + daily schedule (UTC)
Made-with: Cursor
This commit is contained in:
26
.github/workflows/build-and-release.yml
vendored
26
.github/workflows/build-and-release.yml
vendored
@@ -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: |
|
||||
|
||||
Reference in New Issue
Block a user