81 lines
No EOL
2.4 KiB
YAML
81 lines
No EOL
2.4 KiB
YAML
name: Build Traefik from Source
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
traefik_version:
|
|
description: 'Version de Traefik à compiler (ex: v3.2.0)'
|
|
required: true
|
|
default: 'v3.2.0'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.22'
|
|
|
|
- name: Determine Traefik version
|
|
id: version
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
VERSION="${{ github.event.inputs.traefik_version }}"
|
|
else
|
|
VERSION="${{ github.ref_name }}"
|
|
fi
|
|
echo "traefik_version=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "🏷️ Version Traefik: $VERSION"
|
|
|
|
- name: Clone Traefik repository
|
|
run: |
|
|
git clone --depth 1 --branch ${{ steps.version.outputs.traefik_version }} https://github.com/traefik/traefik.git traefik-src
|
|
cd traefik-src
|
|
echo "📦 Traefik ${{ steps.version.outputs.traefik_version }} cloné"
|
|
|
|
- name: Build Traefik
|
|
run: |
|
|
cd traefik-src
|
|
export CGO_ENABLED=0
|
|
make generate
|
|
make binary
|
|
echo "✅ Compilation terminée"
|
|
|
|
- name: Verify binary
|
|
run: |
|
|
cd traefik-src
|
|
./dist/traefik version
|
|
ls -lh ./dist/traefik
|
|
|
|
- name: Create release archive
|
|
run: |
|
|
mkdir -p release
|
|
cp traefik-src/dist/traefik release/
|
|
cd release
|
|
tar -czf traefik-${{ steps.version.outputs.traefik_version }}-linux-amd64.tar.gz traefik
|
|
sha256sum traefik-${{ steps.version.outputs.traefik_version }}-linux-amd64.tar.gz > traefik-${{ steps.version.outputs.traefik_version }}-linux-amd64.tar.gz.sha256
|
|
echo "📦 Archive créée"
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: traefik-${{ steps.version.outputs.traefik_version }}
|
|
path: release/*
|
|
retention-days: 90
|
|
|
|
- name: Create Release (si tag)
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: actions/forgejo-release@v2
|
|
with:
|
|
direction: upload
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
release-dir: release
|
|
tag: ${{ github.ref_name }} |