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
|
name: Build and Release
|
||||||
|
|
||||||
on:
|
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:
|
concurrency:
|
||||||
group: nightly-release-${{ github.repository }}
|
group: nightly-release-${{ github.repository }}
|
||||||
@@ -15,8 +18,27 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
# Clone from Gitea (this runner cannot reach github.com for actions/checkout@v4)
|
||||||
- name: Checkout repository
|
- 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
|
- name: Set up build tools
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user