Some checks failed
Release Workflow / set-release-target (push) Successful in 1s
Release Workflow / build (db, amd64, darwin) (push) Successful in 1m42s
Release Workflow / build (db, amd64, linux) (push) Successful in 1m54s
Release Workflow / build (db, arm64, darwin) (push) Has been cancelled
Release Workflow / build (db, arm64, linux) (push) Has been cancelled
Release Workflow / build (db, arm64, windows) (push) Has been cancelled
Release Workflow / build (metadata, amd64, darwin) (push) Has been cancelled
Release Workflow / build (metadata, amd64, linux) (push) Has been cancelled
Release Workflow / build (metadata, amd64, windows) (push) Has been cancelled
Release Workflow / build (metadata, arm64, darwin) (push) Has been cancelled
Release Workflow / build (metadata, arm64, linux) (push) Has been cancelled
Release Workflow / build (metadata, arm64, windows) (push) Has been cancelled
Release Workflow / publish (push) Has been cancelled
Release Workflow / build (db, amd64, windows) (push) Has been cancelled
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
75 lines
No EOL
2.2 KiB
YAML
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/$BINARI_$GOOS_$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/ |