Skip to content

Commit 71e4964

Browse files
authored
Setup Github Release automation (#29)
* Setup Github Release automation * Fix config file * Add gitignore * Apply suggestion from @sjmiller609 * Also publish helper script
1 parent b815c15 commit 71e4964

File tree

5 files changed

+143
-1
lines changed

5 files changed

+143
-1
lines changed

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release Hypeman API
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: [self-hosted, linux, x64, kvm]
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: '1.25'
24+
25+
- name: Run GoReleaser
26+
uses: goreleaser/goreleaser-action@v6
27+
with:
28+
# gorelease-pro is not required
29+
distribution: goreleaser
30+
version: '~> v2'
31+
args: release --clean
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ lib/system/exec_agent/exec-agent
2323

2424
# Envoy binaries
2525
lib/ingress/binaries/envoy/*/*/envoy
26+
dist/**

.goreleaser.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
2+
version: 2
3+
4+
before:
5+
hooks:
6+
- make release-prep
7+
8+
builds:
9+
- id: hypeman-api
10+
main: ./cmd/api
11+
binary: hypeman-api
12+
env:
13+
- CGO_ENABLED=0
14+
goos:
15+
- linux
16+
goarch:
17+
- amd64
18+
- arm64
19+
tags:
20+
- containers_image_openpgp
21+
ldflags:
22+
- -s -w
23+
- -X main.version={{.Version}}
24+
- -X main.commit={{.Commit}}
25+
- -X main.date={{.Date}}
26+
27+
- id: hypeman-token
28+
main: ./cmd/gen-jwt
29+
binary: hypeman-token
30+
env:
31+
- CGO_ENABLED=0
32+
goos:
33+
- linux
34+
goarch:
35+
- amd64
36+
- arm64
37+
ldflags:
38+
- -s -w
39+
40+
archives:
41+
- id: default
42+
formats:
43+
- tar.gz
44+
name_template: >-
45+
{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}
46+
files:
47+
- LICENSE
48+
- README.md
49+
- RELEASES.md
50+
51+
checksum:
52+
name_template: 'checksums.txt'
53+
54+
changelog:
55+
sort: asc
56+
filters:
57+
exclude:
58+
- '^docs:'
59+
- '^test:'
60+
- '^ci:'
61+
- '^chore:'
62+
- Merge pull request
63+
- Merge branch
64+
65+
release:
66+
github:
67+
owner: onkernel
68+
name: hypeman
69+
prerelease: auto
70+
draft: false

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SHELL := /bin/bash
2-
.PHONY: oapi-generate generate-vmm-client generate-wire generate-all dev build test install-tools gen-jwt download-ch-binaries download-ch-spec ensure-ch-binaries download-envoy-binaries ensure-envoy-binaries
2+
.PHONY: oapi-generate generate-vmm-client generate-wire generate-all dev build test install-tools gen-jwt download-ch-binaries download-ch-spec ensure-ch-binaries download-envoy-binaries ensure-envoy-binaries release-prep
33

44
# Directory where local binaries will be installed
55
BIN_DIR ?= $(CURDIR)/bin
@@ -186,3 +186,8 @@ clean:
186186
rm -f lib/exec/exec.pb.go
187187
rm -f lib/exec/exec_grpc.pb.go
188188
rm -f lib/system/exec_agent/exec-agent
189+
190+
# Prepare for release build (called by GoReleaser)
191+
# Downloads all embedded binaries and builds embedded components
192+
release-prep: download-ch-binaries download-envoy-binaries lib/system/exec_agent/exec-agent
193+
go mod tidy

RELEASES.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Releases
2+
3+
## Versioning
4+
5+
This project uses [Semantic Versioning](https://semver.org/).
6+
7+
## Creating a Release
8+
9+
1. Ensure `main` is in a releasable state (CI passing)
10+
2. Tag the release: `git tag v1.0.0 && git push origin v1.0.0`
11+
3. GitHub Actions builds binaries and creates the release automatically
12+
13+
## Getting Binaries
14+
15+
### Released Version
16+
Download from the [Releases](https://github.com/onkernel/hypeman/releases) page.
17+
18+
### Building from Source
19+
```bash
20+
git clone https://github.com/onkernel/hypeman
21+
cd hypeman
22+
make build
23+
# Binary at ./bin/hypeman
24+
```
25+
26+
## Prereleases
27+
28+
For release candidates before major versions, use semver prerelease syntax:
29+
```
30+
v2.0.0-rc.1 → v2.0.0-rc.2 → v2.0.0
31+
```
32+
33+
Prerelease tags are incremented, not replaced.

0 commit comments

Comments
 (0)