2 Commits

Author SHA1 Message Date
edddc538f9 readme actualizado
Some checks failed
Release / release (push) Has been cancelled
Release / build (amd64, darwin, ) (push) Failing after 38s
Release / build (amd64, linux, ) (push) Failing after 40s
Release / build (arm64, darwin, ) (push) Has been cancelled
Release / build (arm64, linux, ) (push) Has been cancelled
Release / build (amd64, windows, .exe) (push) Has been cancelled
2026-03-31 00:26:23 -03:00
258b1b0a0b actions 2026-03-31 00:18:20 -03:00
2 changed files with 182 additions and 0 deletions

View File

@@ -0,0 +1,127 @@
name: Release
on:
push:
tags:
- 'v*' # Se activa solo con tags como v1.0.0, v2.1.3, etc.
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
suffix: ""
- goos: linux
goarch: arm64
suffix: ""
- goos: windows
goarch: amd64
suffix: ".exe"
- goos: darwin
goarch: amd64
suffix: ""
- goos: darwin
goarch: arm64
suffix: ""
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # necesario para git describe
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: true
- name: Compilar
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
# Nombre del binario: app-linux-amd64, app-windows-amd64.exe, etc.
BINARY_NAME="app-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}"
go build \
-ldflags="-w -s \
-X main.version=${{ gitea.ref_name }} \
-X main.commit=${{ gitea.sha }} \
-X main.buildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-o "dist/${BINARY_NAME}" \
./cmd/main.go
- name: Comprimir artefacto
run: |
cd dist
BINARY_NAME="app-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}"
if [ "${{ matrix.goos }}" = "windows" ]; then
zip "${BINARY_NAME%.exe}.zip" "${BINARY_NAME}"
else
tar -czf "${BINARY_NAME}.tar.gz" "${BINARY_NAME}"
fi
- name: Subir artefacto temporal
uses: actions/upload-artifact@v4
with:
name: bin-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/*.tar.gz
retention-days: 1
release:
runs-on: ubuntu-latest
needs: build # espera que todos los builds terminen
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Descargar todos los artefactos
uses: actions/download-artifact@v4
with:
path: dist/
merge-multiple: true
- name: Generar changelog desde commits
id: changelog
run: |
# Obtener tag anterior
PREV_TAG=$(git tag --sort=-version:refname | sed -n '2p')
if [ -z "$PREV_TAG" ]; then
CHANGES=$(git log --pretty=format:"- %s (%h)" | head -20)
else
CHANGES=$(git log "${PREV_TAG}..${{ gitea.ref_name }}" \
--pretty=format:"- %s (%h)")
fi
# Guardar en archivo para el siguiente paso
echo "${CHANGES}" > changelog.txt
echo "prev_tag=${PREV_TAG}" >> $GITEA_OUTPUT
- name: Crear checksums
run: |
cd dist
sha256sum *.tar.gz *.zip 2>/dev/null > checksums.txt || \
sha256sum *.tar.gz > checksums.txt
cat checksums.txt
- name: Crear Release en Gitea
uses: https://gitea.com/actions/gitea-release-action@v1
with:
token: ${{ secrets.RELEASE_TOKEN }}
tag_name: ${{ gitea.ref_name }}
name: "Release ${{ gitea.ref_name }}"
body_path: changelog.txt
files: |
dist/*.tar.gz
dist/*.zip
dist/checksums.txt

View File

@@ -220,3 +220,58 @@ DOC_ID=$(./claudia-docs doc create -t "Report" -c "# Content" -p $PROJECT_ID --o
./claudia-docs auth --help
./claudia-docs doc --help
```
---
# En tu máquina local
git tag v1.0.0
git push origin v1.0.0
```
---
### Secret necesario
En **Settings → Secrets → Actions** de tu repo:
| Secret | Cómo obtenerlo |
|---|---|
| `RELEASE_TOKEN` | Gitea → Settings → Applications → Generate Token (con permiso `write:repository`) |
---
### Estructura esperada del proyecto
```
mi-proyecto/
├── cmd/
│ └── main.go ← entrypoint
├── go.mod
├── go.sum
└── .gitea/
└── workflows/
└── release.yml
# Si main.go está en la raíz
-o "dist/${BINARY_NAME}" .
# Si está en otro lugar
-o "dist/${BINARY_NAME}" ./internal/cmd/server.go
```
---
### Resultado en Gitea
Una vez que hagas push del tag, en **Releases** del repo verás:
```
Release v1.0.0
├── app-linux-amd64.tar.gz
├── app-linux-arm64.tar.gz
├── app-darwin-amd64.tar.gz
├── app-darwin-arm64.tar.gz
├── app-windows-amd64.zip
└── checksums.txt