fix: use username+token auth for release publish

This commit is contained in:
袁震
2026-04-06 14:26:09 +08:00
parent 568d97a44a
commit 8f38c77416
2 changed files with 5 additions and 2 deletions
+4 -2
View File
@@ -96,6 +96,7 @@ jobs:
shell: bash shell: bash
env: env:
GITEA_BASE_URL: ${{ vars.GITEA_BASE_URL }} GITEA_BASE_URL: ${{ vars.GITEA_BASE_URL }}
GITEA_USERNAME: ${{ vars.GITEA_USERNAME }}
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
TARGET_OWNER: ${{ vars.TARGET_OWNER }} TARGET_OWNER: ${{ vars.TARGET_OWNER }}
TARGET_REPO: ${{ vars.TARGET_REPO }} TARGET_REPO: ${{ vars.TARGET_REPO }}
@@ -108,14 +109,15 @@ jobs:
fi fi
base="${GITEA_BASE_URL:-https://git.halonice.com}" base="${GITEA_BASE_URL:-https://git.halonice.com}"
base="${base%/}" base="${base%/}"
username="${GITEA_USERNAME:-yuanzhen869}"
owner="${TARGET_OWNER:-yuanzhen869}" owner="${TARGET_OWNER:-yuanzhen869}"
repo="${TARGET_REPO:-shunt-rules-release}" repo="${TARGET_REPO:-shunt-rules-release}"
branch="${TARGET_BRANCH:-main}" branch="${TARGET_BRANCH:-main}"
if [[ "${base}" == https://* ]]; then if [[ "${base}" == https://* ]]; then
release_url="https://${GITEA_TOKEN}@${base#https://}/${owner}/${repo}.git" release_url="https://${username}:${GITEA_TOKEN}@${base#https://}/${owner}/${repo}.git"
elif [[ "${base}" == http://* ]]; then elif [[ "${base}" == http://* ]]; then
release_url="http://${GITEA_TOKEN}@${base#http://}/${owner}/${repo}.git" release_url="http://${username}:${GITEA_TOKEN}@${base#http://}/${owner}/${repo}.git"
else else
echo "GITEA_BASE_URL must start with http:// or https://" >&2 echo "GITEA_BASE_URL must start with http:// or https://" >&2
exit 1 exit 1
+1
View File
@@ -118,6 +118,7 @@ bash scripts/release_dist.sh
- `secrets.GITEA_TOKEN`(必需) - `secrets.GITEA_TOKEN`(必需)
- `vars.GITEA_BASE_URL`(可选,默认 `https://git.halonice.com` - `vars.GITEA_BASE_URL`(可选,默认 `https://git.halonice.com`
- `vars.GITEA_USERNAME`(可选,默认 `yuanzhen869`
- `vars.TARGET_OWNER`(可选,默认 `yuanzhen869` - `vars.TARGET_OWNER`(可选,默认 `yuanzhen869`
- `vars.TARGET_REPO`(可选,默认 `shunt-rules-release` - `vars.TARGET_REPO`(可选,默认 `shunt-rules-release`
- `vars.TARGET_BRANCH`(可选,默认 `main` - `vars.TARGET_BRANCH`(可选,默认 `main`