Update 2 files
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 1m19s
Build-Test-Publish / build (linux/arm64) (push) Successful in 2m14s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Successful in 7s
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Successful in 8s

This commit is contained in:
Your Name 2025-06-25 22:47:45 +12:00
parent 884609f661
commit 4d500cbddd
2 changed files with 44 additions and 24 deletions

View File

@ -77,40 +77,60 @@ if ! git config user.email >/dev/null 2>&1; then
git config user.name "CI Bot"
fi
# Check if tag already exists
# Check if tag already exists locally
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists, deleting it first..."
echo "Tag $TAG already exists locally, deleting it first..."
git tag -d "$TAG"
git push origin --delete "$TAG" || true
fi
git tag -a "$TAG" -m "Release $TAG"
if ! git push origin "$TAG"; then
echo "Failed to push tag $TAG to origin" >&2
# Try to delete local tag if push failed
git tag -d "$TAG"
exit 1
# Check if tag exists on remote
if git ls-remote --tags origin | grep -q "refs/tags/$TAG"; then
echo "Tag $TAG already exists on remote - this is expected for multi-architecture builds"
echo "Skipping tag creation and proceeding with release attachment..."
else
echo "Creating new tag $TAG..."
git tag -a "$TAG" -m "Release $TAG"
if ! git push origin "$TAG"; then
echo "Failed to push tag $TAG to origin" >&2
# Try to delete local tag if push failed
git tag -d "$TAG"
exit 1
fi
echo "Successfully created and pushed tag $TAG"
fi
echo "Creating release $TAG on Gitea..."
RELEASE_RESPONSE=$(curl -s -X POST "$API_URL/releases" \
-H "Content-Type: application/json" \
-H "Authorization: token $RELEASE_WRITE_TOKEN" \
-d "$RELEASE_DATA")
echo "Getting or creating release $TAG on Gitea..."
echo "Release API response: $RELEASE_RESPONSE"
# First try to get existing release
EXISTING_RELEASE=$(curl -s -X GET "$API_URL/releases/tags/$TAG" \
-H "Authorization: token $RELEASE_WRITE_TOKEN")
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
if echo "$EXISTING_RELEASE" | grep -q '"id":[0-9]*'; then
# Release already exists, get its ID
RELEASE_ID=$(echo "$EXISTING_RELEASE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
echo "Release $TAG already exists with ID: $RELEASE_ID"
else
# Create new release
echo "Creating new release $TAG on Gitea..."
RELEASE_RESPONSE=$(curl -s -X POST "$API_URL/releases" \
-H "Content-Type: application/json" \
-H "Authorization: token $RELEASE_WRITE_TOKEN" \
-d "$RELEASE_DATA")
if [ -z "$RELEASE_ID" ]; then
echo "Failed to create release on Gitea." >&2
echo "API URL: $API_URL/releases" >&2
echo "Release data: $RELEASE_DATA" >&2
exit 1
echo "Release API response: $RELEASE_RESPONSE"
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
if [ -z "$RELEASE_ID" ]; then
echo "Failed to create release on Gitea." >&2
echo "API URL: $API_URL/releases" >&2
echo "Release data: $RELEASE_DATA" >&2
exit 1
fi
echo "Created new release with ID: $RELEASE_ID"
fi
echo "Created release with ID: $RELEASE_ID"
# Upload binaries and install.sh
echo "Uploading assets to release..."
for FILE in ${PROJECT}.${ARCH_ALIAS} ${PROJECT}.${ARCH} install.sh; do

2
gp/gp
View File

@ -350,7 +350,7 @@ case "${1:-}" in
exit 0
;;
version)
echo "gp version 2.0.0"
echo "2.0.1"
exit 0
;;
esac