Compare commits
No commits in common. "main" and "v.2.0.5" have entirely different histories.
3 changed files with 28 additions and 51 deletions
|
|
@ -12,61 +12,41 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Ejecutar build
|
- name: Ejecutar script de build
|
||||||
run: |
|
run: bash build.sh
|
||||||
mkdir -p release-dir
|
|
||||||
echo "# Documento convertido" > release-dir/documento.md
|
|
||||||
echo "" >> release-dir/documento.md
|
|
||||||
cat archivo.txt >> release-dir/documento.md
|
|
||||||
echo "Release $(date +%Y-%m-%d)" > release-dir/version.txt
|
|
||||||
echo "Build completado"
|
|
||||||
ls -lh release-dir/
|
|
||||||
|
|
||||||
- name: Crear release
|
- name: Crear release con los archivos generados
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
TAG="${GITHUB_REF_NAME}"
|
tag="${GITHUB_REF_NAME}"
|
||||||
|
|
||||||
JSON_PAYLOAD=$(cat <<EOF
|
# Crear el release
|
||||||
{
|
release_response=$(curl -s -X POST \
|
||||||
"tag_name": "${TAG}",
|
-H "Authorization: token $FORGEJO_TOKEN" \
|
||||||
"name": "Release ${TAG}",
|
|
||||||
"body": "Release automatico",
|
|
||||||
"draft": false,
|
|
||||||
"prerelease": false
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
|
|
||||||
echo "Creando release para tag: ${TAG}"
|
|
||||||
|
|
||||||
RESPONSE=$(curl -s -X POST \
|
|
||||||
-H "Authorization: token ${TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "${JSON_PAYLOAD}" \
|
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases" \
|
||||||
"${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 "Respuesta: ${RESPONSE}"
|
echo "$release_response"
|
||||||
|
release_id=$(echo "$release_response" | jq -r '.id')
|
||||||
RELEASE_ID=$(echo "${RESPONSE}" | jq -r '.id')
|
echo "Release creado con ID: $release_id"
|
||||||
|
|
||||||
if [ "${RELEASE_ID}" = "null" ] || [ -z "${RELEASE_ID}" ]; then
|
|
||||||
echo "Error creando release"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Release creado con ID: ${RELEASE_ID}"
|
|
||||||
|
|
||||||
for FILE in release-dir/*; do
|
|
||||||
FILENAME=$(basename "${FILE}")
|
|
||||||
echo "Subiendo ${FILENAME}..."
|
|
||||||
|
|
||||||
|
# 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 \
|
curl -X POST \
|
||||||
-H "Authorization: token ${TOKEN}" \
|
-H "Authorization: token $FORGEJO_TOKEN" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
--data-binary @"${FILE}" \
|
--data-binary @"$file" \
|
||||||
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=${FILENAME}"
|
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets?name=${filename}"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Release completado correctamente"
|
echo "Release completado con todos los archivos"
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
Este es un documento de prueba.
|
|
||||||
Tiene varias líneas.
|
|
||||||
Y será convertido a Markdown.
|
|
||||||
2
test.sh
2
test.sh
|
|
@ -1 +1 @@
|
||||||
echo "holaaaa"
|
echo "holaaaaaa"
|
||||||
Loading…
Reference in a new issue