Skip to content

Commit e568f6c

Browse files
authored
Automate release process (#118)
1 parent 6b24ca9 commit e568f6c

File tree

3 files changed

+72
-2
lines changed

3 files changed

+72
-2
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ bin/
44
**/__pycache__/
55

66
# Local Netlify folder
7-
.netlify
7+
.netlify
8+
# Added by goreleaser init:
9+
dist/
10+
release_assets/

.goreleaser.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Check the documentation at https://goreleaser.com
2+
3+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
4+
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
5+
6+
version: 2
7+
8+
# Prepare files for the release
9+
before:
10+
hooks:
11+
- go mod tidy
12+
# Ensures k8s/ manifests are up-to-date
13+
- go generate ./...
14+
# Prepares the final release manifests
15+
- |
16+
sh -c "
17+
set -e;
18+
mkdir -p release_assets;
19+
20+
# All .yaml files within the k8s/ directory that DO NOT start with 'extensions' are core.
21+
echo 'INFO: Preparing core manifest.yaml';
22+
find k8s -type f -name '*.yaml' -and -not -name 'extensions*' | xargs cat > ./release_assets/manifest.yaml;
23+
24+
# Construct the image URL using the Git tag.
25+
# Note: this requires the image to have been promoted staging manually, after the Git tag is created.
26+
IMAGE_URL='registry.k8s.io/agent-sandbox/agent-sandbox-controller:{{.Tag}}';
27+
28+
echo 'INFO: Replacing image placeholder in core manifest.yaml with: $IMAGE_URL';
29+
sed -i 's|ko://sigs.k8s.io/agent-sandbox/cmd/agent-sandbox-controller.*|'$IMAGE_URL'|' ./release_assets/manifest.yaml;
30+
echo 'INFO: Successfully created release_assets/manifest.yaml';
31+
32+
# All .yaml files within the k8s/ directory that start with 'extensions' are extensions.
33+
echo 'INFO: Preparing extensions.yaml';
34+
find k8s -type f -name 'extensions*.yaml' | xargs cat > ./release_assets/extensions.yaml;
35+
echo 'INFO: Successfully created release_assets/extensions.yaml';
36+
"
37+
38+
# Skipping the build step, as images are built and promoted separately.
39+
builds:
40+
- skip: true
41+
42+
release:
43+
github:
44+
owner: kubernetes-sigs
45+
name: agent-sandbox
46+
47+
# Create a draft release for manual verification before publishing.
48+
draft: true
49+
50+
# Automatically mark releases from tags like 'v0.1.0-rc.1' as a "Pre-release".
51+
prerelease: auto
52+
53+
# GoReleaser will find these files (prepared by the 'before' hook)
54+
# and attach them as assets to the GitHub Release.
55+
extra_files:
56+
- glob: ./release_assets/manifest.yaml
57+
name_template: "manifest.yaml"
58+
- glob: ./release_assets/extensions.yaml
59+
name_template: "extensions.yaml"
60+
61+
changelog:
62+
sort: asc
63+
filters:
64+
exclude:
65+
# Excludes commits that start with 'docs:' or 'test:'
66+
- '^docs:'
67+
- '^test:'

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ require (
99
k8s.io/apiextensions-apiserver v0.34.1
1010
k8s.io/apimachinery v0.34.1
1111
k8s.io/client-go v0.34.1
12+
k8s.io/klog/v2 v2.130.1
1213
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4
1314
sigs.k8s.io/controller-runtime v0.22.2
1415
)
@@ -71,7 +72,6 @@ require (
7172
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
7273
gopkg.in/inf.v0 v0.9.1 // indirect
7374
gopkg.in/yaml.v3 v3.0.1 // indirect
74-
k8s.io/klog/v2 v2.130.1 // indirect
7575
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
7676
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
7777
sigs.k8s.io/randfill v1.0.0 // indirect

0 commit comments

Comments
 (0)