fix(cli,ci): keep --source value in flagsFirst and use GIT_ASKPASS for GitCode push
This commit is contained in:
1 parent
f85e1aba88
commit
172df5c4d5
3 files changed
+24
-10
No files matched your search
@@ -252,8 +252,7 @@ jobs:
|
||||
}
|
||||
$tag = "runtime-$($env:RELEASE_ID)"
|
||||
git fetch --tags origin
|
||||
$auth = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("Nwflower:$($env:GITCODE_TOKEN)"))
|
||||
git -c "http.extraheader=Authorization: Basic $auth" push "https://gitcode.com/Nwflower/Reims-Go.git" "refs/tags/${tag}:refs/tags/${tag}"
|
||||
git -c credential.helper= push "https://Nwflower:$($env:GITCODE_TOKEN)@gitcode.com/Nwflower/Reims-Go.git" "refs/tags/${tag}:refs/tags/${tag}"
|
||||
python scripts/sync-gitcode-release.py $tag
|
||||
|
||||
- name: Prune old alpha prereleases
|
||||
|
||||
@@ -41,10 +41,19 @@ jobs:
|
||||
exit 0
|
||||
fi
|
||||
git fetch --tags origin
|
||||
# Configure token via extraheader so it never appears in remote URLs/logs.
|
||||
auth="$(printf '%s:%s' "$GITCODE_USER" "$GITCODE_TOKEN" | base64 -w0)"
|
||||
git -c "http.extraheader=Authorization: Basic $auth" push "https://gitcode.com/${GITCODE_REPO}.git" HEAD:refs/heads/main
|
||||
git -c "http.extraheader=Authorization: Basic $auth" push "https://gitcode.com/${GITCODE_REPO}.git" --tags
|
||||
# Use GIT_ASKPASS so the token never appears in URLs or process argv.
|
||||
askpass="$(mktemp)"
|
||||
chmod 700 "$askpass"
|
||||
cat > "$askpass" <<'EOF'
|
||||
#!/bin/sh
|
||||
case "$1" in
|
||||
*Username*) printf '%s\n' "$GITCODE_USER" ;;
|
||||
*) printf '%s\n' "$GITCODE_TOKEN" ;;
|
||||
esac
|
||||
EOF
|
||||
trap 'rm -f "$askpass"' EXIT
|
||||
GIT_TERMINAL_PROMPT=0 GIT_ASKPASS="$askpass" git -c credential.helper= push "https://gitcode.com/${GITCODE_REPO}.git" HEAD:refs/heads/main
|
||||
GIT_TERMINAL_PROMPT=0 GIT_ASKPASS="$askpass" git -c credential.helper= push "https://gitcode.com/${GITCODE_REPO}.git" --tags
|
||||
|
||||
- name: Sync Release and assets to GitCode
|
||||
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.sync_releases)
|
||||
|
||||
Reference in new issue
Block a user