diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 261ba79..26d168e 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -122,9 +122,18 @@ jobs: EOF cat website/static/data/kit.json URL="https://x-access-token:${GH_TOKEN}@github.com/${GH_OWNER}/${GH_REPO}.git" + BRANCH="${GH_BRANCH:-main}" rm -rf /tmp/website-pub - git clone --depth 1 --branch "${GH_BRANCH:-main}" "${URL}" /tmp/website-pub - cp -a website/. /tmp/website-pub/ + if git clone --depth 1 --branch "$BRANCH" "${URL}" /tmp/website-pub 2>/dev/null; then + cp -a website/. /tmp/website-pub/ + else + rm -rf /tmp/website-pub + mkdir -p /tmp/website-pub + cd /tmp/website-pub + git init -b "$BRANCH" + git remote add origin "${URL}" + cp -a "$GITHUB_WORKSPACE/website/." . + fi cd /tmp/website-pub git config user.name "kit-ci" git config user.email "kit-ci@honor3.com" @@ -133,5 +142,5 @@ jobs: echo "No website changes to publish" else git commit -m "release(website): publish kit ${REF_NAME}" - git push origin "${GH_BRANCH:-main}" + git push origin "$BRANCH" fi