ci: avoid remote actions in cross build
Some checks failed
Cross Build Windows Release on Linux / cross-build-windows (push) Has been cancelled
Build Windows Release / build-windows (push) Has been cancelled

This commit is contained in:
luochen570
2026-05-30 00:12:49 +08:00
parent f3fb7e877c
commit 4da3e64fcf
2 changed files with 60 additions and 19 deletions

View File

@@ -20,14 +20,26 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
run: |
set -euo pipefail
dnf install -y git rsync
REPO_URL="${GITHUB_SERVER_URL:-https://git.luochen570.cn}/${GITHUB_REPOSITORY}.git"
TOKEN="${GITHUB_TOKEN:-${GITEA_TOKEN:-}}"
if [ -n "$TOKEN" ]; then
git -c http.extraHeader="Authorization: token ${TOKEN}" \
clone --depth 1 --branch "${GITHUB_REF_NAME:-main}" "$REPO_URL" source
else
git clone --depth 1 --branch "${GITHUB_REF_NAME:-main}" "$REPO_URL" source
fi
rsync -a --delete source/ ./
rm -rf source
- name: Install cross build dependencies
run: |
set -euo pipefail
dnf install -y \
git \
cmake \
curl \
ninja-build \
p7zip \
p7zip-plugins \
@@ -106,11 +118,20 @@ jobs:
7z l dist-windows-cross/chengnan-windows-x86_64-cross.zip | grep 'chengnan.exe'
7z l dist-windows-cross/chengnan-windows-x86_64-cross.zip | grep 'platforms/'
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: chengnan-windows-x86_64-cross
path: |
dist-windows-cross/chengnan-windows-x86_64-cross.zip
dist-windows-cross/chengnan-windows-x86_64-cross.zip.sha256
if-no-files-found: error
- name: Upload package to Gitea Packages
run: |
set -euo pipefail
PACKAGE_NAME="chengnan-windows-x86_64-cross"
VERSION="${GITHUB_SHA:-manual}"
VERSION="${VERSION:0:10}"
OWNER="${GITHUB_REPOSITORY%%/*}"
API_BASE="${GITHUB_SERVER_URL:-https://git.luochen570.cn}/api/packages/${OWNER}/generic/chengnan/${VERSION}"
TOKEN="${GITHUB_TOKEN:-${GITEA_TOKEN:-}}"
test -n "$TOKEN"
curl --fail --location --user "${GITHUB_ACTOR:-luochen570}:${TOKEN}" \
--upload-file "dist-windows-cross/${PACKAGE_NAME}.zip" \
"${API_BASE}/${PACKAGE_NAME}.zip"
curl --fail --location --user "${GITHUB_ACTOR:-luochen570}:${TOKEN}" \
--upload-file "dist-windows-cross/${PACKAGE_NAME}.zip.sha256" \
"${API_BASE}/${PACKAGE_NAME}.zip.sha256"
echo "Package uploaded to: ${API_BASE}/"