add ci
Some checks failed
Release Workflow / set-release-target (push) Successful in 1s
Release Workflow / build (db, amd64, darwin) (push) Failing after 39s
Release Workflow / build (db, amd64, linux) (push) Failing after 32s
Release Workflow / build (db, amd64, windows) (push) Failing after 32s
Release Workflow / build (db, arm64, darwin) (push) Failing after 35s
Release Workflow / build (db, arm64, linux) (push) Failing after 33s
Release Workflow / build (db, arm64, windows) (push) Failing after 33s
Release Workflow / build (metadata, amd64, darwin) (push) Successful in 48s
Release Workflow / build (metadata, amd64, linux) (push) Successful in 49s
Release Workflow / build (metadata, amd64, windows) (push) Successful in 49s
Release Workflow / build (metadata, arm64, darwin) (push) Successful in 48s
Release Workflow / build (metadata, arm64, linux) (push) Successful in 49s
Release Workflow / build (metadata, arm64, windows) (push) Successful in 48s
Release Workflow / publish (push) Has been skipped

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2025-12-14 22:14:19 +01:00
commit a88c8ac2b1
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632

View file

@ -0,0 +1,73 @@
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
go build -o dist/$BINARI_$GOOS_$GOARCH ./cmd/$BINARI
echo "artifact pour $RELEASE_CIBLE $BINARI $GOOS $GOARCH" > dist/$BINARI-$GOOS-$GOARCH.txt
- 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/