cleanup #122
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Production Release Test | |
env: | |
USERNAME: hoyle1974 | |
APP_NAME: khronoscope | |
RELEASE_VERSION: v1.0.0 | |
HOMEBREW_TAP_REPO: homebrew-tap | |
on: | |
push: | |
branches: | |
- main | |
- pre-alpha | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.24 | |
- name: Golangci-lint | |
uses: golangci/[email protected] | |
with: | |
args: --timeout=10m --verbose | |
- name: Build | |
run: > | |
GOOS=linux GOARCH=amd64 go build -o ${{ env.APP_NAME }}_linux_amd64 -v ./cmd/khronoscope | |
GOOS=darwin GOARCH=amd64 go build -o ${{ env.APP_NAME }}_darwin_amd64 -v ./cmd/khronoscope | |
GOOS=windows GOARCH=amd64 go build -o ${{ env.APP_NAME }}_windows_amd64.exe -v ./cmd/khronoscope | |
- name: Print SHA for Homebrew | |
run: shasum -a 256 ${{ env.APP_NAME }}_linux_amd64 ${{ env.APP_NAME | |
}}_darwin_amd64 ${{ env.APP_NAME }}_windows_amd64.exe > | |
sha256checksums.txt | |
- name: Create release and attach artifacts | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ github.ref_name }} | |
files: | | |
${{ env.APP_NAME }}_linux_amd64 | |
${{ env.APP_NAME }}_darwin_amd64 | |
${{ env.APP_NAME }}_windows_amd64.exe | |
sha256checksums.txt | |
- name: Create Homebrew formula | |
run: | | |
SHA256=$(grep "${{ env.APP_NAME }}_darwin_amd64" sha256checksums.txt | awk '{ print $1 }') | |
FORMULA="class Khronoscope < Formula | |
desc \"A TUI for VCR controls while inspecting your k8s cluster.\" | |
homepage \"https://github.com/${{ env.USERNAME }}/${{ env.APP_NAME }}\" | |
url \"https://github.com/${{ env.USERNAME }}/${{ env.APP_NAME }}/releases/download/${{ github.ref_name }}/${{ env.APP_NAME }}_darwin_amd64\" | |
sha256 \"$SHA256\" | |
version \"${{ github.ref_name }}\" | |
def install | |
bin.install \"${{ env.APP_NAME }}_darwin_amd64\" => \"${{ env.APP_NAME }}\" | |
end | |
test do | |
system \"#{bin}/${{ env.APP_NAME }}\" | |
end | |
end | |
" | |
echo "$FORMULA" > ${{ env.APP_NAME }}.rb | |
- name: Push formula to Homebrew tap | |
run: | | |
git clone https://github.com/${{ env.USERNAME }}/homebrew-tap.git | |
cd homebrew-tap | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
mv ../${{ env.APP_NAME }}.rb . | |
git add ./${{ env.APP_NAME }}.rb | |
git commit -m "Update formula for ${{ github.ref_name }}" | |
git push https://x-access-token:${{ secrets.HOMEBREW_TAP_TOKEN }}@github.com/${{ env.USERNAME }}/homebrew-tap.git HEAD:main |