Skip to content

Release Build

Release Build #1

Workflow file for this run

name: Release Build
on:
release:
types: [published]
jobs:
build:
name: Build Binaries
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
goos: [linux, darwin, windows]
goarch: ["amd64", "arm64"]
fail-fast: false
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Build Binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
OUTPUT_NAME="k8sdebug-${{ matrix.goos }}-${{ matrix.goarch }}"
if [ "${{ matrix.goos }}" = "windows" ]; then
OUTPUT_NAME="$OUTPUT_NAME.exe"
fi
go build -trimpath -ldflags="-s -w" -o $OUTPUT_NAME main.go
mkdir dist
mv $OUTPUT_NAME dist/
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./dist/k8sdebug-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.exe' || '' }}
asset_name: k8sdebug-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.exe' || '' }}
asset_content_type: application/octet-stream