version from package.json

This commit is contained in:
Nikola Kubiczek 2023-09-25 19:44:16 +02:00
parent b95d9530a9
commit 411e9d931f
Signed by: yaemiku
GPG Key ID: ADC039636B3E4AAB
2 changed files with 11 additions and 3 deletions

View File

@ -17,13 +17,11 @@ build:
- buildah login -u "$REGISTRY_USERNAME" -p "$REGISTRY_PASSWORD" "$REGISTRY" - buildah login -u "$REGISTRY_USERNAME" -p "$REGISTRY_PASSWORD" "$REGISTRY"
script: script:
- buildah images - buildah images
- buildah build -t $IMAGE:latest -t $IMAGE:$CI_COMMIT_TAG - buildah build -t $IMAGE:latest -t $IMAGE:$(sh VERSION)
- buildah images - buildah images
- buildah push --all $IMAGE - buildah push --all $IMAGE
after_script: after_script:
- buildah logout "$REGISTRY" - buildah logout "$REGISTRY"
rules:
- if: $CI_COMMIT_TAG
deploy: deploy:
stage: deploy stage: deploy

10
VERSION Normal file
View File

@ -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