mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-03-25 21:40:52 +00:00
- Update version from 4.4.22 to 4.4.23 in version.txt and pkg/obioptions/version.go - Add zlib1g-dev dependency to Linux release workflow for potential linking requirements - Improve tag creation in Makefile by resolving commit hash with `jj log` for better CI/CD integration
184 lines
5.7 KiB
YAML
184 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
|
|
|
|
# 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.23"
|
|
|
|
- name: Extract version from tag
|
|
id: get_version
|
|
run: |
|
|
TAG=${GITHUB_REF#refs/tags/Release_}
|
|
echo "version=$TAG" >> $GITHUB_OUTPUT
|
|
|
|
- name: Install build tools (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update -q
|
|
sudo apt-get install -y musl-tools zlib1g-dev
|
|
|
|
- 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
|
|
env:
|
|
GOOS: ${{ matrix.goos }}
|
|
GOARCH: ${{ matrix.goarch }}
|
|
VERSION: ${{ steps.get_version.outputs.version }}
|
|
CC: ${{ matrix.goos == 'linux' && 'musl-gcc' || '' }}
|
|
run: |
|
|
if [ "$GOOS" = "linux" ]; then
|
|
make LDFLAGS='-linkmode=external -extldflags=-static' obitools
|
|
else
|
|
make obitools
|
|
fi
|
|
mkdir -p artifacts
|
|
# Create a single tar.gz with all binaries for this platform
|
|
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 }}
|