From 7e1e41c7894f0d9acdb23549d9d9edc231a852bc Mon Sep 17 00:00:00 2001 From: Kristina Date: Sat, 16 May 2026 17:37:37 +0200 Subject: [PATCH] con token 3 --- .gitea/workflows/ci.yaml | 101 +++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 52 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index a55e09b..8cbc5ba 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -1,52 +1,49 @@ -name: Build and Release - -on: - push: - tags: - - 'v*' - -jobs: - build-and-release: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Ejecutar script de build - run: bash build.sh - - - name: Crear release con los archivos generados - env: - RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} - run: | - tag="${GITHUB_REF_NAME}" - - # Crear el release - release_response=$(curl -s -X POST \ - -H "Authorization: token $FORGEJO_TOKEN" \ - -H "Content-Type: application/json" \ - "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases" \ - -d "{ - \"tag_name\": \"${tag}\", - \"name\": \"Release ${tag}\", - \"body\": \"Release automático generado por build.sh\", - \"draft\": false, - \"prerelease\": false - }") - - echo "$release_response" - release_id=$(echo "$release_response" | jq -r '.id') - echo "Release creado con ID: $release_id" - - # Subir todos los archivos que generó el script - for file in release-dir/*; do - filename=$(basename "$file") - echo "Subiendo $filename al release..." - curl -X POST \ - -H "Authorization: token $FORGEJO_TOKEN" \ - -H "Content-Type: application/octet-stream" \ - --data-binary @"$file" \ - "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets?name=${filename}" - done - - echo "Release completado con todos los archivos" \ No newline at end of file +- name: Crear release con debug + env: + RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} + run: | + echo "=== Debug de token ===" + if [ -z "$RELEASE_TOKEN" ]; then + echo "❌ ERROR: RELEASE_TOKEN está vacío" + exit 1 + else + echo "✅ Token presente (longitud: ${#RELEASE_TOKEN})" + fi + + tag="${GITHUB_REF_NAME}" + + echo "=== Creando release ===" + release_response=$(curl -s -w "\nHTTP:%{http_code}" -X POST \ + -H "Authorization: token ${RELEASE_TOKEN}" \ + -H "Content-Type: application/json" \ + "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases" \ + -d "{ + \"tag_name\": \"${tag}\", + \"name\": \"Release ${tag}\", + \"body\": \"Release automático\", + \"draft\": false, + \"prerelease\": false + }") + + echo "$release_response" + + http_code=$(echo "$release_response" | grep "HTTP:" | cut -d: -f2) + echo "Status HTTP: $http_code" + + if [ "$http_code" = "201" ]; then + release_id=$(echo "$release_response" | grep -v "HTTP:" | jq -r '.id') + echo "✅ Release ID: $release_id" + + for file in release-dir/*; do + filename=$(basename "$file") + echo "Subiendo $filename..." + curl -X POST \ + -H "Authorization: token ${RELEASE_TOKEN}" \ + -H "Content-Type: application/octet-stream" \ + --data-binary @"$file" \ + "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets?name=${filename}" + done + else + echo "❌ Error creando release" + exit 1 + fi \ No newline at end of file