3
Some checks failed
Release / build (amd64, darwin, ) (push) Failing after 35s
Release / build (amd64, linux, ) (push) Failing after 10s
Release / build (amd64, windows, .exe) (push) Failing after 10s
Release / build (arm64, darwin, ) (push) Failing after 10s
Release / build (arm64, linux, ) (push) Failing after 9s
Release / release (push) Has been skipped
Some checks failed
Release / build (amd64, darwin, ) (push) Failing after 35s
Release / build (amd64, linux, ) (push) Failing after 10s
Release / build (amd64, windows, .exe) (push) Failing after 10s
Release / build (arm64, darwin, ) (push) Failing after 10s
Release / build (arm64, linux, ) (push) Failing after 9s
Release / release (push) Has been skipped
This commit is contained in:
@@ -3,11 +3,15 @@ name: Release
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*' # Se activa solo con tags como v1.0.0, v2.1.3, etc.
|
- 'v*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
# ← cada job corre dentro de esta imagen
|
||||||
|
container:
|
||||||
|
image: golang:1.22-alpine
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
@@ -28,16 +32,11 @@ jobs:
|
|||||||
suffix: ""
|
suffix: ""
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # necesario para git describe
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: '1.22'
|
|
||||||
cache: true
|
|
||||||
|
|
||||||
- name: Compilar
|
- name: Compilar
|
||||||
env:
|
env:
|
||||||
@@ -45,23 +44,22 @@ jobs:
|
|||||||
GOARCH: ${{ matrix.goarch }}
|
GOARCH: ${{ matrix.goarch }}
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
run: |
|
run: |
|
||||||
# Nombre del binario: app-linux-amd64, app-windows-amd64.exe, etc.
|
|
||||||
BINARY_NAME="app-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}"
|
BINARY_NAME="app-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}"
|
||||||
|
mkdir -p dist
|
||||||
|
|
||||||
go build \
|
go build \
|
||||||
-ldflags="-w -s \
|
-ldflags="-w -s \
|
||||||
-X main.version=${{ gitea.ref_name }} \
|
-X main.version=${{ gitea.ref_name }} \
|
||||||
-X main.commit=${{ gitea.sha }} \
|
-X main.commit=${{ gitea.sha }}" \
|
||||||
-X main.buildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
|
||||||
-o "dist/${BINARY_NAME}" \
|
-o "dist/${BINARY_NAME}" \
|
||||||
./cmd/main.go
|
./cmd/main.go
|
||||||
|
|
||||||
- name: Comprimir artefacto
|
- name: Comprimir
|
||||||
run: |
|
run: |
|
||||||
cd dist
|
cd dist
|
||||||
BINARY_NAME="app-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}"
|
BINARY_NAME="app-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}"
|
||||||
|
|
||||||
if [ "${{ matrix.goos }}" = "windows" ]; then
|
if [ "${{ matrix.goos }}" = "windows" ]; then
|
||||||
|
apk add --no-cache zip
|
||||||
zip "${BINARY_NAME%.exe}.zip" "${BINARY_NAME}"
|
zip "${BINARY_NAME%.exe}.zip" "${BINARY_NAME}"
|
||||||
else
|
else
|
||||||
tar -czf "${BINARY_NAME}.tar.gz" "${BINARY_NAME}"
|
tar -czf "${BINARY_NAME}.tar.gz" "${BINARY_NAME}"
|
||||||
@@ -76,45 +74,43 @@ jobs:
|
|||||||
|
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build # espera que todos los builds terminen
|
needs: build
|
||||||
|
container:
|
||||||
|
image: alpine:3.19
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Instalar dependencias
|
||||||
|
run: apk add --no-cache git
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Descargar todos los artefactos
|
- name: Descargar artefactos
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: dist/
|
path: dist/
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Generar changelog desde commits
|
- name: Generar changelog
|
||||||
id: changelog
|
|
||||||
run: |
|
run: |
|
||||||
# Obtener tag anterior
|
|
||||||
PREV_TAG=$(git tag --sort=-version:refname | sed -n '2p')
|
PREV_TAG=$(git tag --sort=-version:refname | sed -n '2p')
|
||||||
|
|
||||||
if [ -z "$PREV_TAG" ]; then
|
if [ -z "$PREV_TAG" ]; then
|
||||||
CHANGES=$(git log --pretty=format:"- %s (%h)" | head -20)
|
git log --pretty=format:"- %s (%h)" | head -20 > changelog.txt
|
||||||
else
|
else
|
||||||
CHANGES=$(git log "${PREV_TAG}..${{ gitea.ref_name }}" \
|
git log "${PREV_TAG}..${{ gitea.ref_name }}" \
|
||||||
--pretty=format:"- %s (%h)")
|
--pretty=format:"- %s (%h)" > changelog.txt
|
||||||
fi
|
fi
|
||||||
|
cat changelog.txt
|
||||||
# Guardar en archivo para el siguiente paso
|
|
||||||
echo "${CHANGES}" > changelog.txt
|
|
||||||
echo "prev_tag=${PREV_TAG}" >> $GITEA_OUTPUT
|
|
||||||
|
|
||||||
- name: Crear checksums
|
- name: Crear checksums
|
||||||
run: |
|
run: |
|
||||||
cd dist
|
cd dist
|
||||||
sha256sum *.tar.gz *.zip 2>/dev/null > checksums.txt || \
|
sha256sum * > checksums.txt
|
||||||
sha256sum *.tar.gz > checksums.txt
|
|
||||||
cat checksums.txt
|
cat checksums.txt
|
||||||
|
|
||||||
- name: Crear Release en Gitea
|
- name: Crear Release
|
||||||
uses: https://gitea.com/actions/gitea-release-action@v1
|
uses: https://gitea.com/actions/gitea-release-action@v1
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.RELEASE_TOKEN }}
|
token: ${{ secrets.RELEASE_TOKEN }}
|
||||||
@@ -123,5 +119,4 @@ jobs:
|
|||||||
body_path: changelog.txt
|
body_path: changelog.txt
|
||||||
files: |
|
files: |
|
||||||
dist/*.tar.gz
|
dist/*.tar.gz
|
||||||
dist/*.zip
|
|
||||||
dist/checksums.txt
|
dist/checksums.txt
|
||||||
Reference in New Issue
Block a user