Reusable workflows (Go CI, versioning, releases)
In a reusable workflow github.event_name is workflow_call, so the pull_request check skipped the step; test the PR payload instead. |
||
|---|---|---|
| .forgejo/workflows | ||
| README.md | ||
ci/workflows
Reusable workflows for git.tlyng.no projects, called from a project's
.forgejo/workflows/*.yaml with the short form (full URLs don't resolve):
uses: ci/workflows/.forgejo/workflows/<file>.yaml@v1
| Workflow | Purpose |
|---|---|
go.yaml |
lint (golangci-lint), test (gotestsum + coverage), build |
version.yaml |
svu: tag vX.Y.Z if conventional commits since the last tag call for a release |
go-release.yaml |
for a tag: git-cliff notes, goreleaser → Forgejo release, optional image (build, scan, sign) |
rust.yaml |
lint (rustfmt, clippy -D warnings), test (nextest + doc tests), build |
rust-release.yaml |
for a tag: git-cliff notes, goreleaser (Rust builder, cargo-zigbuild cross targets) → Forgejo release, optional image |
The typical project setup (branches + pull requests, conventional commits):
| File | Trigger | Calls |
|---|---|---|
pr.yaml |
pull_request |
go.yaml / rust.yaml |
main.yaml |
push to main (a merge) |
go.yaml / rust.yaml, then version.yaml |
release.yaml |
push of tags v* |
go-release.yaml / rust-release.yaml |
version.yaml and go-release.yaml use the RELEASE_TOKEN secret (user release-bot,
set on user torkel and org ci): tags pushed with the job's automatic token don't
start workflows. The bot needs write access to the project (collaborator or team).
Protect the project with a branch rule on main (no direct pushes, required checks
*lint (pull_request), *test (pull_request), *build (pull_request)) and a tag
rule v* allowing only release-bot.
Complete examples: git.tlyng.no/torkel/hello-go and torkel/hello-rust.