Skip to content

chatgpt

chatgpt #33

Workflow file for this run

# https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63
# TODO: consider using upx to further minimize binary size
name: CI/CD - Build, Test and Release
on:
workflow_dispatch:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
architecture: [amd64, 386, arm64, arm,
riscv64, mips, mips64,
mips64le, mipsle, ppc64,
ppc64le, s390x]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.24.1'
- name: Run tests
run: go test -v ./...
- name: Build
run: >
GOARCH=${{ matrix.architecture }} GOOS=linux go build
-ldflags="-s -w -X main.Version=${{ github.ref_name }}"
-v -o kman-${{ matrix.architecture }}-${{ github.ref_name }} ./cmd/kman/
- name: Display structure of files
run: ls -lRha
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: kman-${{ matrix.architecture }}-${{ github.ref_name }}
path: kman-${{ matrix.architecture }}-${{ github.ref_name }}
release:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: List downloaded files
run: ls -lhR ./artifacts
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: ./artifacts/**/*
token: ${{ secrets.RELEASE_PAT }}