mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-03-25 05:20:52 +00:00
Modification du fichier de workflow de release pour compiler uniquement les outils obitools lors de la construction des binaires pour chaque plateforme (Linux AMD64, Linux ARM64, macOS AMD64, macOS ARM64, Windows AMD64). Cela permet d'optimiser le processus de build en ne générant que les binaires nécessaires.
177 lines
5.7 KiB
YAML
177 lines
5.7 KiB
YAML
name: Create Release on Tag
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "Release_*"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
# First run tests
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.23"
|
|
- name: Checkout obitools4 project
|
|
uses: actions/checkout@v4
|
|
- name: Run tests
|
|
run: make githubtests
|
|
|
|
# Then create release only if tests pass
|
|
create-release:
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.23"
|
|
|
|
- name: Extract version from tag
|
|
id: get_version
|
|
run: |
|
|
TAG=${GITHUB_REF#refs/tags/Release_}
|
|
echo "version=$TAG" >> $GITHUB_OUTPUT
|
|
echo "tag_name=Release_$TAG" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build binaries for multiple platforms
|
|
env:
|
|
VERSION: ${{ steps.get_version.outputs.version }}
|
|
run: |
|
|
mkdir -p release
|
|
|
|
# Build for Linux AMD64
|
|
echo "Building for Linux AMD64..."
|
|
GOOS=linux GOARCH=amd64 make obitools
|
|
cd build
|
|
for binary in *; do
|
|
tar -czf ../release/${binary}_${VERSION}_linux_amd64.tar.gz ${binary}
|
|
done
|
|
cd ..
|
|
rm -rf build
|
|
|
|
|
|
# Build for Linux ARM64
|
|
echo "Building for Linux ARM64..."
|
|
GOOS=linux GOARCH=arm64 make obitools
|
|
cd build
|
|
for binary in *; do
|
|
tar -czf ../release/${binary}_${VERSION}_linux_arm64.tar.gz ${binary}
|
|
done
|
|
cd ..
|
|
rm -rf build
|
|
|
|
|
|
# Build for macOS AMD64 (Intel)
|
|
echo "Building for macOS AMD64..."
|
|
GOOS=darwin GOARCH=amd64 make obitools
|
|
cd build
|
|
for binary in *; do
|
|
tar -czf ../release/${binary}_${VERSION}_darwin_amd64.tar.gz ${binary}
|
|
done
|
|
cd ..
|
|
rm -rf build
|
|
|
|
|
|
# Build for macOS ARM64 (Apple Silicon)
|
|
echo "Building for macOS ARM64..."
|
|
GOOS=darwin GOARCH=arm64 make obitools
|
|
cd build
|
|
for binary in *; do
|
|
tar -czf ../release/${binary}_${VERSION}_darwin_arm64.tar.gz ${binary}
|
|
done
|
|
cd ..
|
|
rm -rf build
|
|
|
|
|
|
# Build for Windows AMD64
|
|
echo "Building for Windows AMD64..."
|
|
GOOS=windows GOARCH=amd64 make obitools
|
|
cd build
|
|
for binary in *; do
|
|
# Windows binaries have .exe extension
|
|
if [ -f "${binary}.exe" ]; then
|
|
zip ../release/${binary}_${VERSION}_windows_amd64.zip ${binary}.exe
|
|
else
|
|
zip ../release/${binary}_${VERSION}_windows_amd64.zip ${binary}
|
|
fi
|
|
done
|
|
cd ..
|
|
|
|
echo "Built archives:"
|
|
ls -lh release/
|
|
|
|
- name: Generate Release Notes
|
|
id: release_notes
|
|
env:
|
|
VERSION: ${{ steps.get_version.outputs.version }}
|
|
run: |
|
|
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
|
|
|
|
echo "# OBITools4 Release ${VERSION}" > release_notes.md
|
|
echo "" >> release_notes.md
|
|
|
|
if [ -n "$PREV_TAG" ]; then
|
|
echo "## Changes since ${PREV_TAG}" >> release_notes.md
|
|
echo "" >> release_notes.md
|
|
git log ${PREV_TAG}..HEAD --pretty=format:"- %s" >> release_notes.md
|
|
else
|
|
echo "## Changes" >> release_notes.md
|
|
echo "" >> release_notes.md
|
|
git log --pretty=format:"- %s" -n 20 >> release_notes.md
|
|
fi
|
|
|
|
echo "" >> release_notes.md
|
|
echo "" >> release_notes.md
|
|
echo "## Installation" >> release_notes.md
|
|
echo "" >> release_notes.md
|
|
echo "Download the appropriate binary for your system and extract it:" >> release_notes.md
|
|
echo "" >> release_notes.md
|
|
echo "### Linux (AMD64)" >> release_notes.md
|
|
echo '```bash' >> release_notes.md
|
|
echo "tar -xzf <tool>_${VERSION}_linux_amd64.tar.gz" >> release_notes.md
|
|
echo '```' >> release_notes.md
|
|
echo "" >> release_notes.md
|
|
echo "### Linux (ARM64)" >> release_notes.md
|
|
echo '```bash' >> release_notes.md
|
|
echo "tar -xzf <tool>_${VERSION}_linux_arm64.tar.gz" >> release_notes.md
|
|
echo '```' >> release_notes.md
|
|
echo "" >> release_notes.md
|
|
echo "### macOS (Intel)" >> release_notes.md
|
|
echo '```bash' >> release_notes.md
|
|
echo "tar -xzf <tool>_${VERSION}_darwin_amd64.tar.gz" >> release_notes.md
|
|
echo '```' >> release_notes.md
|
|
echo "" >> release_notes.md
|
|
echo "### macOS (Apple Silicon)" >> release_notes.md
|
|
echo '```bash' >> release_notes.md
|
|
echo "tar -xzf <tool>_${VERSION}_darwin_arm64.tar.gz" >> release_notes.md
|
|
echo '```' >> release_notes.md
|
|
echo "" >> release_notes.md
|
|
echo "### Windows (AMD64)" >> release_notes.md
|
|
echo '```powershell' >> release_notes.md
|
|
echo "Expand-Archive <tool>_${VERSION}_windows_amd64.zip" >> release_notes.md
|
|
echo '```' >> release_notes.md
|
|
echo "" >> release_notes.md
|
|
echo "Available tools: Replace \`<tool>\` with one of the obitools commands." >> release_notes.md
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
name: Release ${{ steps.get_version.outputs.version }}
|
|
body_path: release_notes.md
|
|
files: release/*
|
|
draft: false
|
|
prerelease: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|