-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·33 lines (27 loc) · 1.23 KB
/
Copy pathrelease.sh
File metadata and controls
executable file
·33 lines (27 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
# Cut a release: annotated git tag, multi-arch image on Docker Hub, GitHub release.
# Run from the repo root. Requires: docker login (Hub), gh auth login (GitHub).
#
# Usage: ./release.sh v3.0.2 [notes-file.md]
set -euo pipefail
TAG="${1:?usage: ./release.sh vX.Y.Z [notes-file.md]}"
NOTES_FILE="${2:-}"
IMAGE="gacerioni/gabs-redis-langcache"
echo ">> Tagging ${TAG}"
git tag -a "$TAG" -m "Release $TAG" || echo " tag already exists, reusing"
git push origin "$TAG"
echo ">> Building and pushing ${IMAGE}:${TAG} (linux/amd64 + linux/arm64)"
# Build context comes from `git archive` of the tag: only tracked files are
# sent to the builder, so local secrets (.env) can never leak into the image.
git archive "$TAG" | docker buildx build \
--platform linux/amd64,linux/arm64 \
-t "${IMAGE}:${TAG}" -t "${IMAGE}:latest" \
--push -
echo ">> Creating GitHub release ${TAG}"
if [ -n "$NOTES_FILE" ]; then
gh release create "$TAG" --title "$TAG" --notes-file "$NOTES_FILE"
else
gh release create "$TAG" --title "$TAG" --generate-notes
fi
echo ">> Done: https://github.com/Redislabs-Solution-Architects/redis-langcache-python-example/releases/tag/${TAG}"
echo ">> https://hub.docker.com/r/gacerioni/gabs-redis-langcache/tags"