mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-03-25 13:30:52 +00:00
This commit simplifies the artifact packaging process by creating a single tar.gz file containing all binaries for each platform, instead of individual files. It also updates the release notes to reflect the new packaging approach and corrects the documentation to use the new naming convention 'obitools4' instead of '<tool>'.
173 lines
5.3 KiB
YAML
173 lines
5.3 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 (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 }}
|
|
run: |
|
|
make obitools
|
|
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 }}
|