Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: goreleaser

on:
pull_request:
push:
branches:
- 'main'
tags:
- 'v*'

permissions:
contents: write

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

# - name: Debug
# run: |
# printenv | sort

- name: Test
run: go test -v ./...

build:
name: Build Release
needs: [ test ]
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean --skip=validate --skip=publish
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the PR build job, goreleaser release --skip=publish is still a full release flow and typically requires a tag; on pull requests this commonly fails unless --snapshot is used (or goreleaser build is run instead). Consider switching this to a snapshot build to validate packaging on PRs without needing tags.

Suggested change
args: release --clean --skip=validate --skip=publish
args: release --clean --skip=validate --skip=publish --snapshot

Copilot uses AI. Check for mistakes.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release:
name: Release and publish
needs: [ test ]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*~
/dist/
/hemlock-sendmsg
/hemlock-sendmsg.exe
/secrets/*
Expand Down
31 changes: 31 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: 2

env:
- GO111MODULE=on

before:
hooks:
- go mod download

builds:
- main: ./...
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
Comment on lines +10 to +17
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GoReleaser builds.main should point to a single main package (e.g. ././cmd/...), not ./... (which is a pattern for go tooling and can break GoReleaser builds). Also, since the Go code expects GoReleaser to set version/commit/date/builtBy via -ldflags, add an ldflags section here to actually inject those values (e.g. -X main.version=..., etc.).

Copilot uses AI. Check for mistakes.

archives:
- files:
- README.md

release:
prerelease: auto

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ install:
> /etc/systemd/system/hemlock-sendmsg.service
systemctl daemon-reload
systemctl enable hemlock-sendmsg

.PHONY: snapshot
snapshot:
goreleaser release --snapshot --clean
Loading
Loading