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
7 changes: 7 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ config.example.yaml # Annotated example configuration
testdata/config.yaml # Test fixture
.goreleaser-github.yaml # Release config used by the GitHub release workflow
.goreleaser-gitea.yaml # Release config used by the Gitea release workflow (release disabled, Harbor images only)
cog.toml # cocogitto release config: `cog bump` tags the merged master commit and pushes it to GitHub and Gitea
Dockerfile # Multi-stage build (Go builder + Alpine runtime)
.github/workflows/
test.yml # CI: tests, lint, fmt on push/PR
Expand Down Expand Up @@ -123,6 +124,12 @@ For AI coding agents: after making code changes, run `go fix ./...` before tests
- **Tests**: standard `testing` package, table-driven tests, `t.TempDir()` for temp dirs. Sync tests use in-process bare git repos created via `initBareAndClone()` helper. No external test dependencies or test frameworks.
- **No Makefile**: build and test with standard `go` commands.

## Release

- Cut with `cog bump --auto` (`cog.toml`) on a `master` that matches GitHub's; a pre-bump hook refuses otherwise. It tags the merged commit, with no bump commit or changelog since changes land through GitHub PRs, and pushes `master` and the tag to `origin` (GitHub) and `gitea` (the mirror, kept up to date only by this push).
- On GitHub the tag runs `.github/workflows/release.yml` (GoReleaser binaries, GitHub release, GHCR image); on Gitea it runs `.gitea/workflows/release.yml` (Harbor image only).
- `--auto` derives the version from the commit types since the last tag (`feat` minor, `fix` patch, `!` major), so commit subjects must follow the style below.

## Git commit style

- **Mandatory User Approval**: NEVER commit changes unless the user explicitly asks you to.
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,25 @@ gfetch dev (commit: none, built: unknown)

Version, commit, and build date are injected at build time via ldflags when using GoReleaser or a manual build with `-ldflags`.

## Release

Releases are cut with [cocogitto](https://docs.cocogitto.io/) on a `master`
that matches GitHub's; `cog bump` refuses to run otherwise (cog 7.0.0 reports
that refusal as a `StashError` panic):

```sh
cog bump --auto --dry-run # print the version it would cut
cog bump --auto
```

`--auto` picks the version from the commit types since the last tag; pass
`--patch`, `--minor` or `--major` instead to choose it. cog tags the merged
commit, with no bump commit since changes land through GitHub PRs, and pushes
`master` and the tag to `origin` (GitHub) and `gitea`. On GitHub the tag runs
[GoReleaser](https://goreleaser.com/), which publishes the release binaries and
the `ghcr.io/obmondo/gfetch` image; on Gitea it builds the
`harbor.obmondo.com/obmondo/gfetch` image.

## Documentation

[Configuration Reference](docs/configuration.md)
Expand Down
28 changes: 28 additions & 0 deletions cog.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
tag_prefix = "v"
branch_whitelist = ["master"]
ignore_merge_commits = true
disable_changelog = true
# Changes land through GitHub PRs, so tag the merged commit instead of adding one.
disable_bump_commit = true
# Older commits do not all follow Conventional Commits, so `cog check` starts
# at the latest tag.
from_latest_tag = true

pre_bump_hooks = [
# Tag exactly GitHub's master: not behind it, nothing unmerged on top.
# When one of these fails, cog 7.0.0 panics with a StashError instead of
# naming the hook; no tag is created and nothing is pushed.
"git fetch origin master",
"git merge-base --is-ancestor origin/master HEAD",
"git merge-base --is-ancestor HEAD origin/master",
]

post_bump_hooks = [
# origin is GitHub, where the tag builds the release and the GHCR image.
# gitea is a mirror that only these pushes keep up to date, and the tag there
# builds the Harbor image, so master and the tag go to both. cog stops at the
# first hook that fails and keeps the tag, so a failed gitea push is retried
# by hand: git push --no-follow-tags gitea master <tag>
"git push --no-follow-tags origin master {{version_tag}}",
"git push --no-follow-tags gitea master {{version_tag}}",
]
Loading