add hantim.net
This commit is contained in:
+19
-2
@@ -276,10 +276,27 @@ git push
|
||||
# --- Trigger initial build ---
|
||||
|
||||
echo "==> Triggering initial build for $APP..."
|
||||
curl -sf -X POST "$GITEA_URL/api/v1/repos/$GITEA_ORG/$APP/contents/.deploy-trigger" \
|
||||
TRIGGER_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||
-X POST "$GITEA_URL/api/v1/repos/$GITEA_ORG/$APP/contents/.deploy-trigger" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"content\": \"$(echo -n "initial deploy" | base64)\", \"message\": \"trigger initial build\"}" > /dev/null
|
||||
-d "{\"content\": \"$(echo -n "initial deploy" | base64)\", \"message\": \"trigger initial build\"}")
|
||||
|
||||
if [ "$TRIGGER_CODE" = "201" ]; then
|
||||
echo " Build triggered."
|
||||
elif [ "$TRIGGER_CODE" = "422" ]; then
|
||||
# File already exists — update it to trigger a new build
|
||||
EXISTING_SHA=$(curl -s "$GITEA_URL/api/v1/repos/$GITEA_ORG/$APP/contents/.deploy-trigger" \
|
||||
-H "Authorization: token $GITEA_TOKEN" | jq -r '.sha')
|
||||
curl -s -o /dev/null -X PUT "$GITEA_URL/api/v1/repos/$GITEA_ORG/$APP/contents/.deploy-trigger" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"content\": \"$(echo -n "redeploy $(date +%s)" | base64)\", \"sha\": \"$EXISTING_SHA\", \"message\": \"trigger rebuild\"}"
|
||||
echo " Build re-triggered (file already existed)."
|
||||
else
|
||||
echo " Warning: Could not trigger build (HTTP $TRIGGER_CODE). Check manually:"
|
||||
echo " $GITEA_URL/$GITEA_ORG/$APP/actions"
|
||||
fi
|
||||
|
||||
# --- Verify ---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user