two/.forgejo/workflows/build.yml
GnomeZworc f699a34a65
All checks were successful
Release Workflow / build (db, amd64, linux) (push) Successful in 1m33s
Release Workflow / build (db, amd64, windows) (push) Successful in 2m4s
Release Workflow / set-release-target (push) Successful in 1s
Release Workflow / build (db, amd64, darwin) (push) Successful in 1m35s
Release Workflow / build (db, arm64, darwin) (push) Successful in 1m57s
Release Workflow / build (db, arm64, linux) (push) Successful in 1m59s
Release Workflow / build (db, arm64, windows) (push) Successful in 1m58s
Release Workflow / build (metadata, amd64, darwin) (push) Successful in 1m43s
Release Workflow / build (metadata, amd64, linux) (push) Successful in 1m45s
Release Workflow / build (metadata, amd64, windows) (push) Successful in 1m43s
Release Workflow / build (metadata, arm64, darwin) (push) Successful in 1m39s
Release Workflow / build (metadata, arm64, linux) (push) Successful in 1m42s
Release Workflow / build (metadata, arm64, windows) (push) Successful in 1m41s
Release Workflow / publish (push) Successful in 7s
fix error
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
2025-12-14 22:32:00 +01:00

75 lines
No EOL
2.2 KiB
YAML

name: Release Workflow
on:
push:
tags:
- '*'
branches:
- main
pull_request:
types: [closed]
branches:
- main
jobs:
set-release-target:
runs-on: docker
outputs:
release_cible: ${{ steps.setvar.outputs.release_cible }}
steps:
- name: Déterminer la release cible
id: setvar
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
TAG="${GITHUB_REF#refs/tags/}"
echo "release_cible=$TAG" >> $GITHUB_OUTPUT
elif [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
echo "release_cible=latest" >> $GITHUB_OUTPUT
else
echo "release_cible=unknown" >> $GITHUB_OUTPUT
fi
- name: Afficher la variable
run: echo "Release cible = ${{ steps.setvar.outputs.release_cible }}"
build:
runs-on: docker
needs: set-release-target
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
binaries: [db, metadata]
env:
RELEASE_CIBLE: ${{ needs.set-release-target.outputs.release_cible }}
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
BINARI: ${{ matrix.binaries }}
CGO_ENABLED: 0
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Build du projet
run: |
echo "Building for $BINARI/$GOOS/$GOARCH (release: $RELEASE_CIBLE)"
go env GOOS GOARCH
mkdir -p dist/
go build -o dist/${{ matrix.binaries }}_${{ matrix.goos }}_${{ matrix.goarch }} ./cmd/$BINARI
echo "artifact pour $RELEASE_CIBLE $BINARI $GOOS $GOARCH" > dist/$BINARI-$GOOS-$GOARCH.txt
ls -l ./dist
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.binaries }}-${{ env.RELEASE_CIBLE }}-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/${{ matrix.binaries }}_${{ matrix.goos }}_${{ matrix.goarch }}
publish:
runs-on: docker
needs: build
steps:
- name: Download all build artifacts
uses: actions/download-artifact@v3
with:
path: dist/
- name: Publier tous les binaires
run: ls -l dist/