chore(release): prepare v0.7.0
This commit is contained in:
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
repo_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
cd "$repo_root"
|
||||
|
||||
version=$(python3 -c 'import pathlib,tomllib; print(tomllib.loads(pathlib.Path("pyproject.toml").read_text())["project"]["version"])')
|
||||
image_ref=${1:-trex-core:$version}
|
||||
source_commit=$(git rev-parse HEAD)
|
||||
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "release image build requires a clean checkout" >&2
|
||||
exit 2
|
||||
fi
|
||||
case "$image_ref" in
|
||||
*:"$version") ;;
|
||||
*) echo "image reference must use the project version tag :$version" >&2; exit 2 ;;
|
||||
esac
|
||||
|
||||
docker build \
|
||||
--build-arg "SOURCE_COMMIT=$source_commit" \
|
||||
--build-arg "SOURCE_VERSION=$version" \
|
||||
--tag "$image_ref" \
|
||||
.
|
||||
|
||||
actual_revision=$(docker image inspect --format '{{ index .Config.Labels "org.opencontainers.image.revision" }}' "$image_ref")
|
||||
actual_version=$(docker image inspect --format '{{ index .Config.Labels "org.opencontainers.image.version" }}' "$image_ref")
|
||||
actual_user=$(docker image inspect --format '{{ .Config.User }}' "$image_ref")
|
||||
|
||||
[ "$actual_revision" = "$source_commit" ]
|
||||
[ "$actual_version" = "$version" ]
|
||||
[ "$actual_user" = "10001:10001" ]
|
||||
docker run --rm "$image_ref" --version
|
||||
|
||||
printf 'image=%s\nversion=%s\nrevision=%s\nimage_id=%s\n' \
|
||||
"$image_ref" "$actual_version" "$actual_revision" \
|
||||
"$(docker image inspect --format '{{ .Id }}' "$image_ref")"
|
||||
Reference in New Issue
Block a user