Skip to content

fix: override systemd unit (#110) #22

fix: override systemd unit (#110)

fix: override systemd unit (#110) #22

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Tag to release"
required: true
permissions:
contents: write
jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: linux
arch: amd64
goarch: amd64
- os: linux
arch: arm64
goarch: arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Get version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi
- name: Build binary
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.goarch }}
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
GIT_COMMIT=$(git rev-parse --short HEAD)
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS="-X main.Version=${VERSION} -X main.GitCommit=${GIT_COMMIT} -X main.BuildTime=${BUILD_DATE} -w -s"
BINARY_NAME="aks-flex-node-${{ matrix.os }}-${{ matrix.arch }}"
go build -ldflags "${LDFLAGS}" -o "${BINARY_NAME}" .
# Create tarball
tar -czf "${BINARY_NAME}.tar.gz" "${BINARY_NAME}"
echo "ASSET=${BINARY_NAME}.tar.gz" >> $GITHUB_ENV
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.os }}-${{ matrix.arch }}
path: ${{ env.ASSET }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: binaries-*
path: ./artifacts
- name: Consolidate artifacts
run: |
mkdir -p release-assets
find artifacts -name "*.tar.gz" -exec cp {} release-assets/ \;
ls -lh release-assets/
- name: Generate checksums
run: |
cd release-assets
sha256sum *.tar.gz > checksums.txt
cat checksums.txt
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.VERSION }}
name: Release ${{ steps.version.outputs.VERSION }}
generate_release_notes: true
body: |
## AKS Flex Node ${{ steps.version.outputs.VERSION }}
### Installation
**Quick install (Ubuntu 22.04/24.04):**
```bash
curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/${{ steps.version.outputs.VERSION }}/scripts/install.sh | sudo bash
```
**Manual installation:**
1. Download the appropriate binary for your platform
2. Extract the archive: `tar -xzf aks-flex-node-*.tar.gz`
3. Move the binary to your PATH: `sudo mv aks-flex-node-* /usr/local/bin/aks-flex-node`
4. Make it executable: `sudo chmod +x /usr/local/bin/aks-flex-node`
### Supported Platforms
- **Ubuntu 22.04 LTS (AMD64)**: `aks-flex-node-linux-amd64.tar.gz`
- **Ubuntu 22.04 LTS (ARM64)**: `aks-flex-node-linux-arm64.tar.gz`
- **Ubuntu 24.04 LTS**: Compatible with AMD64 and ARM64 binaries above
### Verification
Verify your download with the checksums in `checksums.txt`.
### What's Changed
<!-- Add your changelog here -->
files: |
release-assets/*.tar.gz
release-assets/checksums.txt
draft: false
prerelease: false
fail_on_unmatched_files: true
token: ${{ secrets.GITHUB_TOKEN }}