Publish images under the git version tag too
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -39,7 +39,7 @@ docker compose down # stop
|
|||||||
docker compose pull && docker compose up -d # update to the newest published version
|
docker compose pull && docker compose up -d # update to the newest published version
|
||||||
```
|
```
|
||||||
|
|
||||||
To pin a version, set `WHATTODO_TAG=<commit>` in `.env` (default: `latest`).
|
To pin a version, set `WHATTODO_TAG=<version>` in `.env`, e.g. `v1.0` or a commit (default: `latest`).
|
||||||
|
|
||||||
## Develop (build from source)
|
## Develop (build from source)
|
||||||
|
|
||||||
@@ -58,6 +58,7 @@ docker compose run --rm test # run the test suite (in Docker)
|
|||||||
|
|
||||||
`./publish.sh` builds the last commit (uncommitted changes are left out) and pushes it to
|
`./publish.sh` builds the last commit (uncommitted changes are left out) and pushes it to
|
||||||
`git.goyban.com/goyban/whattodo` as `:latest` and `:<commit>`. `./publish.sh <tag|branch|commit>` publishes another version.
|
`git.goyban.com/goyban/whattodo` as `:latest` and `:<commit>`. `./publish.sh <tag|branch|commit>` publishes another version.
|
||||||
|
To release a numbered version, tag the commit first: `git tag v1.1 && ./publish.sh v1.1` also pushes the image as `:v1.1`.
|
||||||
Log in once first with `docker login git.goyban.com`, using a Gitea token with package write access as the password.
|
Log in once first with `docker login git.goyban.com`, using a Gitea token with package write access as the password.
|
||||||
|
|
||||||
### Testing on your phone (same Wi-Fi)
|
### Testing on your phone (same Wi-Fi)
|
||||||
|
|||||||
+14
-5
@@ -5,6 +5,9 @@
|
|||||||
# ./publish.sh # builds HEAD
|
# ./publish.sh # builds HEAD
|
||||||
# ./publish.sh v1.2 # builds a tag/branch/commit
|
# ./publish.sh v1.2 # builds a tag/branch/commit
|
||||||
#
|
#
|
||||||
|
# The image is tagged with the commit and `latest`, plus the version when the commit has a git tag
|
||||||
|
# like v1.2. To release a new version: git tag v1.2 && ./publish.sh v1.2
|
||||||
|
#
|
||||||
# One-time setup: docker login git.goyban.com (password = a Gitea token with package write access)
|
# One-time setup: docker login git.goyban.com (password = a Gitea token with package write access)
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
@@ -15,9 +18,15 @@ REF="${1:-HEAD}"
|
|||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
SHA="$(git rev-parse --short "$REF^{commit}")"
|
SHA="$(git rev-parse --short "$REF^{commit}")"
|
||||||
|
|
||||||
echo "Building $IMAGE from $REF ($SHA)"
|
# Newest version tag (v1.2, v1.2.3) on this commit, if any.
|
||||||
git archive --format=tar "$REF" | docker build --target runtime -t "$IMAGE:$SHA" -t "$IMAGE:latest" -
|
VERSION="$(git tag --points-at "$SHA" --list 'v[0-9]*' --sort=-v:refname | head -n 1)"
|
||||||
|
TAGS=("$SHA" latest)
|
||||||
|
if [ -n "$VERSION" ]; then TAGS+=("$VERSION"); fi
|
||||||
|
|
||||||
docker push "$IMAGE:$SHA"
|
echo "Building $IMAGE from $REF ($SHA${VERSION:+, $VERSION})"
|
||||||
docker push "$IMAGE:latest"
|
BUILD_TAGS=()
|
||||||
echo "Pushed $IMAGE:$SHA and $IMAGE:latest"
|
for t in "${TAGS[@]}"; do BUILD_TAGS+=(-t "$IMAGE:$t"); done
|
||||||
|
git archive --format=tar "$REF" | docker build --target runtime "${BUILD_TAGS[@]}" -
|
||||||
|
|
||||||
|
for t in "${TAGS[@]}"; do docker push "$IMAGE:$t"; done
|
||||||
|
echo "Pushed $IMAGE with tags: ${TAGS[*]}"
|
||||||
|
|||||||
Reference in New Issue
Block a user