No description
- Shell 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| bin | ||
| README.md | ||
release
Tags the current commit and pushes the docker image of a project.
The version is the latest git tag reachable from HEAD, without any v
prefix. release bumps it, creates an annotated tag, pushes it, then runs
docker buildx bake --push with the new version in the TAG variable.
Usage
release # same as release patch
release patch # 1.0.6 -> 1.0.7
release minor # 1.0.6 -> 1.1.0
release major # 1.0.6 -> 2.0.0
release current # prints the current version
release refuses to run if the working tree is not clean or if there is no
docker-bake.hcl in the current directory.
Project setup
The project needs a docker-bake.hcl at its root that reads the TAG
variable:
variable "TAG" { default = "dev" }
target "default" {
platforms = ["linux/amd64", "linux/arm64"]
tags = ["registry.example.com/user/project:${TAG}"]
pull = true
}
The file is passed explicitly with -f, so a docker-compose.yml next to it
is never picked up by bake.
If the repository has no tag yet, the version starts at 0.0.0, so the first
release produces 0.0.1. To start from an existing version, tag the
matching commit by hand first:
git tag -a 1.0.6 -m "Release 1.0.6" <sha>
git push --follow-tags
Requirements
- git
- docker with buildx
- a tpm installation (uses
lib/log.sh)