Skip to content

Commit 1dd08c8

Browse files
authored
Release Process pt 1 (#35)
- Clean-up unnecessary assets from the repo generation template - Start of release process with goreleaser and github actions workflows
1 parent 9848b52 commit 1dd08c8

19 files changed

Lines changed: 2352 additions & 925 deletions

.custom-gcl.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# with all the plugins listed below.
44
#
55
# See: https://golangci-lint.run/plugins/module-plugins/
6-
version: v2.8.0
6+
version: v2.12.2
77
plugins:
88
# logcheck validates structured logging calls and parameters (e.g., balanced key-value pairs)
99
- module: "sigs.k8s.io/logtools"

.devcontainer/devcontainer.json

Lines changed: 0 additions & 35 deletions
This file was deleted.

.devcontainer/post-install.sh

Lines changed: 0 additions & 153 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Release
2+
3+
# Releases are cut from GitHub Actions only, triggered by pushing a vX.Y.Z tag.
4+
on:
5+
push:
6+
tags:
7+
- "v*"
8+
9+
permissions:
10+
contents: write # create the GitHub release
11+
packages: write # push images to ghcr.io
12+
13+
jobs:
14+
release:
15+
name: Run on Ubuntu
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Clone the code
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0 # GoReleaser needs full history and tags
22+
23+
- name: Setup Go
24+
uses: actions/setup-go@v5
25+
with:
26+
go-version-file: go.mod
27+
cache-dependency-path: |
28+
go.sum
29+
tools/go.sum
30+
31+
- name: Cache local tool binaries
32+
uses: actions/cache@v4
33+
with:
34+
path: bin
35+
key: tools-release-${{ runner.os }}-${{ hashFiles('Makefile', 'tools/go.sum') }}
36+
restore-keys: |
37+
tools-release-${{ runner.os }}-
38+
39+
# ko (run by GoReleaser) authenticates to the registry via the Docker
40+
# config this writes; GITHUB_TOKEN carries packages:write from above.
41+
- name: Log in to GitHub Container Registry
42+
uses: docker/login-action@v4
43+
with:
44+
registry: ghcr.io
45+
username: ${{ github.actor }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: Release
49+
run: make release
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ go.work
3131

3232
# Test artifacts
3333
_artifacts/
34+
35+
# Release artifacts (GoReleaser / build-installer output)
36+
dist/

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ linters:
4545
- dupl
4646
- lll
4747
path: internal/*
48+
- linters:
49+
- goconst
50+
path: _test\.go
4851
paths:
4952
- third_party$
5053
- builtin$

.goreleaser.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# GoReleaser configuration.
2+
# Cuts a GitHub release and publishes multi-arch (linux/amd64,linux/arm64)
3+
# container images to the ghcr repo. Runs in CI only; see
4+
# .github/workflows/release.yml. Test locally with `make release-snapshot`.
5+
#
6+
# Docs: https://goreleaser.com/customization/ko/
7+
version: 2
8+
9+
# ko re-builds the binary itself using these settings (results are cached from
10+
# the build pipe). CGO is disabled so the image can run on the distroless base.
11+
builds:
12+
- id: manager
13+
main: ./cmd
14+
binary: manager
15+
env:
16+
- CGO_ENABLED=0
17+
flags:
18+
- -trimpath
19+
goos:
20+
- linux
21+
goarch:
22+
- amd64
23+
- arm64
24+
25+
# Build and publish multi-arch images with ko. Auth comes from the CI env
26+
# (docker login to ghcr.io); the base image defaults to the distroless,
27+
# nonroot cgr.dev/chainguard/static.
28+
kos:
29+
- build: manager
30+
repositories:
31+
- ghcr.io/oxidecomputer/cluster-api-provider-oxide
32+
platforms:
33+
- linux/amd64
34+
- linux/arm64
35+
tags:
36+
- "{{ .Tag }}"
37+
- latest
38+
# Push to the bare repo (no import-path or MD5 suffix).
39+
bare: true
40+
preserve_import_paths: false
41+
# Reproducible image/file timestamps from the release commit.
42+
creation_time: "{{ .CommitTimestamp }}"
43+
ko_data_creation_time: "{{ .CommitTimestamp }}"

0 commit comments

Comments
 (0)