From 411e9d931fe821b7412ffaad4b31d0bd70b139de Mon Sep 17 00:00:00 2001 From: yaemiku Date: Mon, 25 Sep 2023 19:44:16 +0200 Subject: [PATCH] version from package.json --- .gitlab-ci.yml | 4 +--- VERSION | 10 ++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 VERSION diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d38429f..6a153d8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,13 +17,11 @@ build: - buildah login -u "$REGISTRY_USERNAME" -p "$REGISTRY_PASSWORD" "$REGISTRY" script: - buildah images - - buildah build -t $IMAGE:latest -t $IMAGE:$CI_COMMIT_TAG + - buildah build -t $IMAGE:latest -t $IMAGE:$(sh VERSION) - buildah images - buildah push --all $IMAGE after_script: - buildah logout "$REGISTRY" - rules: - - if: $CI_COMMIT_TAG deploy: stage: deploy diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..fc2a6aa --- /dev/null +++ b/VERSION @@ -0,0 +1,10 @@ +#!/bin/sh + +# Version key/value should be on his own line +PACKAGE_VERSION=$(cat package.json \ + | grep version \ + | head -1 \ + | awk -F: '{ print $2 }' \ + | sed 's/[",]//g') + +echo $PACKAGE_VERSION \ No newline at end of file