chore(ci): tag-triggered release workflow and helpers
Release / build-and-push (push) Successful in 1m17s
Release / build-and-push (push) Successful in 1m17s
Add .gitea/workflows/release.yml: on v* tag push (or manual dispatch) build the Docker image and push git.linuxhg.com/games-database/games-api:<tag> plus :latest, then create/update the Gitea Release from the annotated tag message. Main-branch pushes do nothing so WIP never ships. Add cliff.toml (conventional-commit grouping for release notes), Makefile release target (cliff notes into annotated tag, then push), and ./release wrapper (accepts 1.0 or v1.0). Release flow: ./release v1.0, matching bookhoard. Requires a REGISTRY_TOKEN repo Actions secret (PAT with write:package and write:repository); Gitea's auto token lacks package scope.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
.PHONY: help release
|
||||
|
||||
# Default target
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@echo ""
|
||||
@echo "Release:"
|
||||
@echo " ./release v0.1.0 - Tag, push, and release (notes auto-generated from commits)"
|
||||
@echo " make release VERSION=v0.1.0 - Same, explicit make form"
|
||||
|
||||
# Create an annotated version tag carrying auto-generated release notes (git-cliff)
|
||||
# and push it. The tag push triggers .gitea/workflows/release.yml, which builds the
|
||||
# image and publishes a Gitea Release whose body is this tag's message. Notes come
|
||||
# entirely from Conventional Commits — no hand-written message required.
|
||||
#
|
||||
# git-cliff's --latest needs the tag to exist to scope the notes, so we create a
|
||||
# throwaway lightweight tag, generate the notes, replace it with an annotated tag,
|
||||
# then push. --cleanup=verbatim keeps the markdown "###" group headers (git's
|
||||
# default cleanup would strip lines starting with "#").
|
||||
#
|
||||
# Requires git-cliff: https://git-cliff.org/install
|
||||
# Usage: make release VERSION=v0.1.0
|
||||
release:
|
||||
@test -n "$(VERSION)" || { echo "Usage: make release VERSION=v0.1.0"; exit 1; }
|
||||
@command -v git-cliff >/dev/null 2>&1 || { echo "git-cliff not found — install: https://git-cliff.org/install"; exit 1; }
|
||||
@if git rev-parse "$(VERSION)" >/dev/null 2>&1; then echo "Tag $(VERSION) already exists locally — delete it first: git tag -d $(VERSION)"; exit 1; fi
|
||||
@echo "Generating release notes for $(VERSION)..."
|
||||
@git tag "$(VERSION)" HEAD && \
|
||||
(git cliff --latest --config cliff.toml > .release-notes.tmp && git tag -d "$(VERSION)" >/dev/null) || \
|
||||
{ git tag -d "$(VERSION)" >/dev/null 2>&1; rm -f .release-notes.tmp; echo "git-cliff failed"; exit 1; }
|
||||
@git tag -a --cleanup=verbatim -F .release-notes.tmp "$(VERSION)" HEAD && rm -f .release-notes.tmp
|
||||
@git push origin "$(VERSION)"
|
||||
@echo "Pushed $(VERSION) — Gitea Actions will build the image and publish the Release."
|
||||
Reference in New Issue
Block a user