Skip to content

Instantly share code, notes, and snippets.

@damiancipolat
Created April 4, 2022 00:04
Show Gist options
  • Save damiancipolat/f526cdcb32190eaa576a2dd1080bd430 to your computer and use it in GitHub Desktop.
Save damiancipolat/f526cdcb32190eaa576a2dd1080bd430 to your computer and use it in GitHub Desktop.
Docker tagger using package.json version field.
#Extract project field name package.json
export PACKAGE_NAME="$(cat package.json | grep name | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g')"
#Extract version field from package.json
export PACKAGE_VERSION="$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g')"
#Set the package tag name
export PACKAGE_TAG="$(echo ${PACKAGE_NAME}:${PACKAGE_VERSION} | tr -d ' ')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment