Skip to content

fix homebrew support #14

fix homebrew support

fix homebrew support #14

name: Build, Test, and Release
on:
push:
branches:
- main
tags:
- "v*.*.*"
pull_request:
branches:
- main
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.22"]
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Check out code
uses: actions/checkout@v4
- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Get dependencies
run: go mod download
- name: Build
run: make build-all
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: binaries
path: build/*
retention-days: 1
release:
name: Release
needs: build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Get and set tag
id: tag
run: |
tag=$(echo ${GITHUB_REF} | cut -d'/' -f3)
echo "tag=${tag}" >> $GITHUB_ENV
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: binaries
path: build
- name: Generate changelog
id: changelog
uses: metcalfc/[email protected]
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
- name: Generate checksums
run: shasum -a 256 build/* > build/checksums.txt
- name: Remove "build/" from each line in checksums.txt
run: sed -i -e 's/build\///g' build/checksums.txt
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: build/*
name: "Release ${{ env.tag }}"
body: ${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}