Skip to content

Instantly share code, notes, and snippets.

@loopmode
Last active May 15, 2023 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loopmode/21ab0b42df200a614fa22304b500e064 to your computer and use it in GitHub Desktop.
Save loopmode/21ab0b42df200a614fa22304b500e064 to your computer and use it in GitHub Desktop.
prepends a comment with version info, timestamp and git commit hash
#!/bin/sh
# prepends a comment with version info, timestamp and git commit hash
file="./build/embed.js"
timestamp=$(date '+%Y-%m-%d %H:%m:%S')
commithash=$(git rev-parse --short HEAD)
version=$(cat ./package.json | grep version -m 1 | sed 's/"version": "//' | sed 's/",//' | xargs)
buildinfo="$version $timestamp $commithash"
echo "/* $buildinfo */\n$(cat $file)" > $file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment