Skip to content

Release

Release #22

Workflow file for this run

name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write
container:
image: golang:1.26-alpine
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract version from tag
id: get_version
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Extracted version: ${VERSION}"
- name: Install dependencies
run: |
apk add --no-cache make zip tar bash gzip
- name: Test build
run: |
make test
- name: Build binaries
run: |
make build-windows-amd64
make build-windows-arm64
make build-linux-amd64
make build-linux-arm64
make build-macos
- name: Build WASM
run: |
make build-wasm
- name: Prepare packaging directory
run: |
mkdir -p packages
- name: Package all binaries
run: |
VERSION="${{ steps.get_version.outputs.version }}"
# Function to package binaries
package_binary() {
local platform=$1
local arch=$2
local ext=$3
local compress=$4
local pkg_name="synapseq-${VERSION}-${platform}-${arch}"
local bin_src="bin/synapseq-${platform}-${arch}${ext}"
local bin_name="synapseq-${VERSION}-${platform}-${arch}${ext}"
local sha_name="${bin_name}.sha256"
echo "Packaging ${pkg_name}..."
# Create temporary directory for packaging
mkdir -p "temp-${pkg_name}"
# Copy binary with versioned name
cp "${bin_src}" "temp-${pkg_name}/${bin_name}"
# Set executable permission for Unix systems
if [ -z "$ext" ]; then
chmod +x "temp-${pkg_name}/${bin_name}"
fi
# Generate SHA256 for the binary
cd "temp-${pkg_name}"
sha256sum "${bin_name}" > "${sha_name}"
cd ..
echo "✓ SHA256 generated: ${sha_name}"
# Create compressed package
if [ "$compress" = "zip" ]; then
cd "temp-${pkg_name}"
zip "../packages/${pkg_name}.zip" "${bin_name}" "${sha_name}"
cd ..
else
tar -czf "packages/${pkg_name}.tar.gz" -C "temp-${pkg_name}" "${bin_name}" "${sha_name}"
fi
# Clean up temporary directory
rm -rf "temp-${pkg_name}"
echo "✓ ${pkg_name} packaged successfully"
}
# Package Windows binaries (ZIP format)
package_binary "windows" "amd64" ".exe" "zip"
package_binary "windows" "arm64" ".exe" "zip"
# Package Linux binaries (TAR.GZ format)
package_binary "linux" "amd64" "" "tar.gz"
package_binary "linux" "arm64" "" "tar.gz"
# Package macOS binaries (TAR.GZ format)
package_binary "macos" "arm64" "" "tar.gz"
- name: Package WASM
run: |
VERSION="${{ steps.get_version.outputs.version }}"
pkg_name="synapseq-${VERSION}-wasm"
echo "Packaging WASM version..."
# Create temporary directory for packaging
mkdir -p "temp-${pkg_name}"
# Copy WASM files
cp wasm/synapseq.wasm "temp-${pkg_name}/"
cp wasm/synapseq.js "temp-${pkg_name}/"
cp wasm/wasm_exec.js "temp-${pkg_name}/"
cp wasm/example.html "temp-${pkg_name}/"
# Generate SHA256 checksums for WASM files
cd "temp-${pkg_name}"
sha256sum synapseq.wasm synapseq.js wasm_exec.js example.html > checksums.txt
cd ..
echo "✓ SHA256 checksums generated for WASM files"
# Create ZIP package
cd "temp-${pkg_name}"
zip "../packages/${pkg_name}.zip" synapseq.wasm synapseq.js wasm_exec.js example.html checksums.txt
cd ..
# Clean up temporary directory
rm -rf "temp-${pkg_name}"
echo "✓ ${pkg_name} packaged successfully"
- name: Generate checksums
run: |
cd packages
sha256sum *.zip *.tar.gz > checksums.txt
cat checksums.txt
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: SynapSeq ${{ steps.get_version.outputs.version }}
files: |
packages/*.zip
packages/*.tar.gz
packages/checksums.txt
draft: true
prerelease: false
generate_release_notes: no
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}