mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-03-25 13:30:52 +00:00
- Upgrade Go version from 1.23 to 1.26 in release.yml - Remove CGO_CFLAGS from cross-compilation matrix entries - Replace Linux build tools installation with Docker-based static build using golang:1.26-alpine - Simplify macOS build to use standard make without special flags - Increment version to 4.4.26
188 lines
5.8 KiB
YAML
188 lines
5.8 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.26"
|
|
- name: Checkout obitools4 project
|
|
uses: actions/checkout@v4
|
|
- name: Run tests
|
|
run: make githubtests
|
|
|
|
# Build binaries for each platform
|
|
build:
|
|
needs: test
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
goos: linux
|
|
goarch: amd64
|
|
output_name: linux_amd64
|
|
- os: ubuntu-24.04-arm
|
|
goos: linux
|
|
goarch: arm64
|
|
output_name: linux_arm64
|
|
- os: macos-15-intel
|
|
goos: darwin
|
|
goarch: amd64
|
|
output_name: darwin_amd64
|
|
- os: macos-latest
|
|
goos: darwin
|
|
goarch: arm64
|
|
output_name: darwin_arm64
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.26"
|
|
|
|
- name: Extract version from tag
|
|
id: get_version
|
|
run: |
|
|
TAG=${GITHUB_REF#refs/tags/Release_}
|
|
echo "version=$TAG" >> $GITHUB_OUTPUT
|
|
|
|
- name: Install build tools (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
# Ensure Xcode Command Line Tools are installed
|
|
xcode-select --install 2>/dev/null || true
|
|
xcode-select -p
|
|
|
|
- name: Build binaries (Linux)
|
|
if: runner.os == 'Linux'
|
|
env:
|
|
VERSION: ${{ steps.get_version.outputs.version }}
|
|
run: |
|
|
docker run --rm \
|
|
-v "$(pwd):/src" \
|
|
-w /src \
|
|
-e VERSION="${VERSION}" \
|
|
golang:1.26-alpine \
|
|
sh -c "apk add --no-cache gcc musl-dev zlib-dev make && \
|
|
make LDFLAGS='-linkmode=external -extldflags=-static' obitools"
|
|
mkdir -p artifacts
|
|
tar -czf artifacts/obitools4_${VERSION}_${{ matrix.output_name }}.tar.gz -C build .
|
|
|
|
- name: Build binaries (macOS)
|
|
if: runner.os == 'macOS'
|
|
env:
|
|
GOOS: ${{ matrix.goos }}
|
|
GOARCH: ${{ matrix.goarch }}
|
|
VERSION: ${{ steps.get_version.outputs.version }}
|
|
run: |
|
|
make obitools
|
|
mkdir -p artifacts
|
|
tar -czf artifacts/obitools4_${VERSION}_${{ matrix.output_name }}.tar.gz -C build .
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: binaries-${{ matrix.output_name }}
|
|
path: artifacts/*
|
|
|
|
# Create the release
|
|
create-release:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Extract version from tag
|
|
id: get_version
|
|
run: |
|
|
TAG=${GITHUB_REF#refs/tags/Release_}
|
|
echo "version=$TAG" >> $GITHUB_OUTPUT
|
|
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: release-artifacts
|
|
|
|
- name: Prepare release directory
|
|
run: |
|
|
mkdir -p release
|
|
find release-artifacts -type f -name "*.tar.gz" -exec cp {} release/ \;
|
|
ls -lh release/
|
|
|
|
- name: Generate 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 archive 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 obitools4_${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 obitools4_${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 obitools4_${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 obitools4_${VERSION}_darwin_arm64.tar.gz" >> release_notes.md
|
|
echo '```' >> release_notes.md
|
|
echo "" >> release_notes.md
|
|
echo "All OBITools4 binaries are included in each archive." >> 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 }}
|