Skip to content

fix: update command for Linux/macOS only; add dependabot and CodeQL #2

fix: update command for Linux/macOS only; add dependabot and CodeQL

fix: update command for Linux/macOS only; add dependabot and CodeQL #2

Workflow file for this run

name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
build:
name: Build Binaries
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
VERSION=${GITHUB_REF_NAME}
COMMIT=$(git rev-parse --short HEAD)
DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS="-s -w -X efctl/cmd.Version=${VERSION} -X efctl/cmd.CommitSHA=${COMMIT} -X efctl/cmd.BuildDate=${DATE}"
BINARY_NAME=efctl-${{ matrix.goos }}-${{ matrix.goarch }}
if [ "${{ matrix.goos }}" = "windows" ]; then
BINARY_NAME=${BINARY_NAME}.exe
fi
mkdir -p output
go build -trimpath -ldflags="${LDFLAGS}" -o output/$BINARY_NAME main.go
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.goos }}-${{ matrix.goarch }}
path: output/efctl-*
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v4
with:
path: binaries
pattern: binary-*
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: binaries/*
generate_release_notes: true