diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e49595e..94a5eba 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -259,8 +259,9 @@ jobs: - name: build image run: make -j build/image/envbox - - name: tag image - run: docker tag envbox ghcr.io/coder/envbox:latest - - - name: push image - run: docker push ghcr.io/coder/envbox:latest + - name: Tag and push envbox-preview + run: | + VERSION=$(./scripts/version.sh)-dev-$(git rev-parse --short HEAD) + BASE=ghcr.io/coder/envbox-preview + docker tag envbox "${BASE}:${VERSION}" + docker push "${BASE}:${VERSION}" diff --git a/scripts/version.sh b/scripts/version.sh new file mode 100755 index 0000000..31968d2 --- /dev/null +++ b/scripts/version.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")" + +last_tag="$(git describe --tags --abbrev=0)" +version="$last_tag" + +# Remove the "v" prefix. +echo "${version#v}"