From 2adc5db8513b62bd660f85d117b59e418f6328b6 Mon Sep 17 00:00:00 2001 From: Jose Quintana Date: Tue, 3 Mar 2020 10:27:21 +0100 Subject: [PATCH] refactor: relocate version script --- Makefile | 4 ++-- docker/version.sh | 37 +++++++++++++++++++++++++++++++++++++ scripts/version.sh | 37 ------------------------------------- 3 files changed, 39 insertions(+), 39 deletions(-) create mode 100755 docker/version.sh delete mode 100755 scripts/version.sh diff --git a/Makefile b/Makefile index e631cb6..82147ca 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ prod.release.tag: git push --delete origin latest # Update docker files to latest tag per platform - ./scripts/version.sh v$(PKG_TAG) + ./docker/version.sh v$(PKG_TAG) git add . git commit . -m "v$(PKG_TAG)" @@ -223,5 +223,5 @@ prod.release.tag: prod.release.dockerfiles: # Update docker files to latest tag per platform - ./scripts/version.sh v$(PKG_TAG) + ./docker/version.sh v$(PKG_TAG) .ONESHELL: prod.release.dockerfiles diff --git a/docker/version.sh b/docker/version.sh new file mode 100755 index 0000000..ea02cdf --- /dev/null +++ b/docker/version.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +set -e +set -u + +LATEST_TAG=$1 +BASE_PATH="$(pwd)/docker" + +if [ $# -eq 0 ]; then + echo "Usage: ./version.sh " + exit +fi + +export VERSION=$LATEST_TAG +export ALPINE_VERSION=3.10 + +PLATFORMS=( + "alpine" + "scratch" +) + +for PLATFORM in "${PLATFORMS[@]}"; do + PLATFORM_DIR="${BASE_PATH}/${PLATFORM}" + + if [ ! -d "$PLATFORM_DIR" ]; then + echo "Directory no found for \"${PLATFORM_DIR}\"" + exit 1 + fi + + echo "Generating Dockerfile for platform \"${PLATFORM}\"" + + rm -rf "${PLATFORM_DIR}/Dockerfile" + + envsubst \$ALPINE_VERSION,\$VERSION <"${PLATFORM_DIR}/Dockerfile.tmpl" >"${PLATFORM_DIR}/Dockerfile" +done + +echo "All Dockerfiles were updated!" diff --git a/scripts/version.sh b/scripts/version.sh deleted file mode 100755 index a9a4a2a..0000000 --- a/scripts/version.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -u - -LATEST_TAG=$1 -BASE_PATH="$(pwd)/docker" - -if [ $# -eq 0 ]; then - echo "Usage: ./version.sh " - exit -fi - -export VERSION=$LATEST_TAG -export ALPINE_VERSION=3.10 - -PLATFORMS=( - "alpine" - "scratch" -) - -for PLATFORM in "${PLATFORMS[@]}"; do - PLATFORM_DIR="${BASE_PATH}/${PLATFORM}" - - if [ ! -d "$PLATFORM_DIR" ]; then - echo "Directory no found for \"${PLATFORM_DIR}\"" - exit 1 - fi - - echo "Generating Dockerfile for platform \"${PLATFORM}\"" - - rm -rf "${PLATFORM_DIR}/Dockerfile" - - envsubst \$ALPINE_VERSION,\$VERSION <"${PLATFORM_DIR}/Dockerfile.tmpl" >"${PLATFORM_DIR}/Dockerfile" -done - -echo "All Dockerfiles were updated!" -- libgit2 1.7.2