Compare commits
13 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f209927867 | ||
|
|
7e1e41c789 | ||
|
|
43c152ac0b | ||
|
|
b1d1465156 | ||
|
|
eb71eb8d4d | ||
|
|
532f8cb2b7 | ||
|
|
0916804b5c | ||
|
|
9954a9cd0c | ||
|
|
444606d63b | ||
|
|
4c56d6fc51 | ||
| 7ecd9a0c7a | |||
|
|
f2a87acdf5 | ||
|
|
12e5e50936 |
4 changed files with 74 additions and 21 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
name: prueba release
|
name: Build and Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
@ -7,31 +7,66 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-release:
|
build-and-release:
|
||||||
runs-on: ubuntu-latest # Cambia esto por el label de tu runner
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Build
|
- name: Ejecutar build
|
||||||
run: |
|
run: |
|
||||||
mkdir -p dist
|
mkdir -p release-dir
|
||||||
echo "hola release" > dist/mi-artefacto.txt
|
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: Create release
|
- name: Crear release
|
||||||
env:
|
env:
|
||||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
TOKEN: ${{ secrets.RELEASE_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 $FORGEJO_TOKEN" \
|
-H "Authorization: token ${TOKEN}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases" \
|
--data-binary @"${FILE}" \
|
||||||
-d "{
|
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=${FILENAME}"
|
||||||
\"tag_name\": \"${tag}\",
|
done
|
||||||
\"name\": \"${title}\",
|
|
||||||
\"body\": \"Release creado desde Forgejo Actions\",
|
echo "Release completado correctamente"
|
||||||
\"draft\": false,
|
|
||||||
\"prerelease\": false
|
|
||||||
}"
|
|
||||||
3
archivo.txt
Normal file
3
archivo.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
Este es un documento de prueba.
|
||||||
|
Tiene varias líneas.
|
||||||
|
Y será convertido a Markdown.
|
||||||
15
build.sh
Normal file
15
build.sh
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/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 "holaaaaaa"
|
echo "holaaaa"
|
||||||
Loading…
Reference in a new issue