Compare commits
No commits in common. "main" and "v2.0.1" have entirely different histories.
4 changed files with 21 additions and 74 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
name: Build and Release
|
name: prueba release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
@ -7,66 +7,31 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-release:
|
build-and-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest # Cambia esto por el label de tu runner
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Ejecutar build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
mkdir -p release-dir
|
mkdir -p dist
|
||||||
echo "# Documento convertido" > release-dir/documento.md
|
echo "hola release" > dist/mi-artefacto.txt
|
||||||
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: Create release
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
TAG="${GITHUB_REF_NAME}"
|
tag="${GITHUB_REF_NAME}"
|
||||||
|
title="$tag"
|
||||||
JSON_PAYLOAD=$(cat <<EOF
|
|
||||||
{
|
|
||||||
"tag_name": "${TAG}",
|
|
||||||
"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" \
|
|
||||||
-d "${JSON_PAYLOAD}" \
|
|
||||||
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases")
|
|
||||||
|
|
||||||
echo "Respuesta: ${RESPONSE}"
|
|
||||||
|
|
||||||
RELEASE_ID=$(echo "${RESPONSE}" | jq -r '.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}..."
|
|
||||||
|
|
||||||
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/json" \
|
||||||
--data-binary @"${FILE}" \
|
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases" \
|
||||||
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=${FILENAME}"
|
-d "{
|
||||||
done
|
\"tag_name\": \"${tag}\",
|
||||||
|
\"name\": \"${title}\",
|
||||||
echo "Release completado correctamente"
|
\"body\": \"Release creado desde Forgejo Actions\",
|
||||||
|
\"draft\": false,
|
||||||
|
\"prerelease\": false
|
||||||
|
}"
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
Este es un documento de prueba.
|
|
||||||
Tiene varias líneas.
|
|
||||||
Y será convertido a Markdown.
|
|
||||||
15
build.sh
15
build.sh
|
|
@ -1,15 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Crear directorio para el release
|
|
||||||
mkdir -p release-dir
|
|
||||||
|
|
||||||
# Convertir txt a md (ejemplo simple)
|
|
||||||
echo "# Documento convertido" > release-dir/documento.md
|
|
||||||
echo "" >> release-dir/documento.md
|
|
||||||
cat archivo.txt >> release-dir/documento.md
|
|
||||||
|
|
||||||
# Crear archivo de versión
|
|
||||||
echo "Release $(date +%Y-%m-%d)" > release-dir/version.txt
|
|
||||||
|
|
||||||
echo "Build completado. Archivos en release-dir/"
|
|
||||||
ls -lh release-dir/
|
|
||||||
2
test.sh
2
test.sh
|
|
@ -1 +1 @@
|
||||||
echo "holaaaa"
|
echo "holaaaaaa"
|
||||||
Loading…
Reference in a new issue