Some checks failed
Release / Build darwin-amd64 (push) Has been cancelled
Release / Build linux-amd64 (push) Has been cancelled
Release / Build darwin-arm64 (push) Has been cancelled
Release / Build linux-arm64 (push) Has been cancelled
Release / Create Release (push) Has been cancelled
- Add GitHub Actions workflow for multi-platform releases - Build for linux/darwin on amd64/arm64 - Auto-create GitHub Release with checksums - Version injection via ldflags - Add init.d script support for install command - Rewrite README with clearer documentation - Quick start guide - Two-node HA setup example - Health check configuration - Troubleshooting section - Bump version to 1.2.1 🤖 Generated with [Qoder][https://qoder.com]
96 lines
2.4 KiB
YAML
96 lines
2.4 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
name: Build ${{ matrix.os }}-${{ matrix.arch }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: linux
|
|
arch: amd64
|
|
- os: linux
|
|
arch: arm64
|
|
- os: darwin
|
|
arch: amd64
|
|
- os: darwin
|
|
arch: arm64
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.21'
|
|
|
|
- name: Get version
|
|
id: version
|
|
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build binary
|
|
env:
|
|
GOOS: ${{ matrix.os }}
|
|
GOARCH: ${{ matrix.arch }}
|
|
CGO_ENABLED: 0
|
|
run: |
|
|
mkdir -p dist
|
|
BINARY_NAME=go-alived-${{ matrix.os }}-${{ matrix.arch }}
|
|
if [ "${{ matrix.os }}" = "windows" ]; then
|
|
BINARY_NAME="${BINARY_NAME}.exe"
|
|
fi
|
|
go build -ldflags="-s -w -X github.com/loveuer/go-alived/internal/cmd.Version=${{ steps.version.outputs.VERSION }}" \
|
|
-o dist/${BINARY_NAME} .
|
|
|
|
# Create checksum
|
|
cd dist && sha256sum ${BINARY_NAME} > ${BINARY_NAME}.sha256
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: go-alived-${{ matrix.os }}-${{ matrix.arch }}
|
|
path: dist/
|
|
|
|
release:
|
|
name: Create Release
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Prepare release files
|
|
run: |
|
|
mkdir -p release
|
|
find artifacts -type f -exec cp {} release/ \;
|
|
ls -la release/
|
|
|
|
- name: Get version
|
|
id: version
|
|
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
name: Release ${{ steps.version.outputs.VERSION }}
|
|
draft: false
|
|
prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-beta') || contains(github.ref, '-alpha') }}
|
|
generate_release_notes: true
|
|
files: release/*
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|