Skip to content

Merge tag 'v0.20.0' #19

Merge tag 'v0.20.0'

Merge tag 'v0.20.0' #19

Workflow file for this run

# .github/workflows/build-release.yml
name: Build Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.23.1]
os: [linux, windows, darwin]
arch: [amd64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Set up variables
run: |
GITSHA=$(git rev-parse --short HEAD)
TAG=${GITHUB_REF#refs/tags/}
VERSION=${TAG#v}
echo GITSHA=$GITSHA >>$GITHUB_ENV
echo VERSION=$VERSION >>$GITHUB_ENV
- name: Define the executable name for Linux and macOS
if: ${{ matrix.os != 'windows' }}
run: tee -a $GITHUB_ENV <<<CONFD=confd-$VERSION-${{ matrix.os }}-${{ matrix.arch }}
- name: Define the executable name for Windows
if: ${{ matrix.os == 'windows' }}
run: tee -a $GITHUB_ENV <<<CONFD=confd-$VERSION-${{ matrix.os }}-${{ matrix.arch }}.exe
- name: Build `confd`
env:
CGO_ENABLED: 0
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: go build -o bin/$CONFD -ldflags "-s -w -X main.Version=$VERSION -X main.GitSHA=$GITSHA"
- name: Compress `confd`
if: ${{ matrix.os != 'windows' }}
run: upx --brute bin/$CONFD
- name: Upload `confd`
uses: actions/upload-artifact@v4
with:
name: ${{ env.CONFD }}
path: bin/${{ env.CONFD }}
publish:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download `confd`
uses: actions/download-artifact@v4
with:
# Files will be downloaded to `bin/$name/$name`
path: bin
- name: Fix downloaded `confd` paths
working-directory: bin
run: |
for d in */; do
mv -v "$d" tmp
mv -v tmp/* .
rm -frv tmp
done
- name: Create release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: bin/*
# vim:set sw=2 ts=2 et: