Merge pull request #36 from rancher/version-number

Add versions file to build
This commit is contained in:
Neil MacDougall 2023-04-17 18:45:02 +01:00 committed by GitHub
commit ae51cb31c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -63,6 +63,7 @@ cp -R node_modules/bootstrap/dist/** ${DIST}
# Patch bootstrap.css to remove source mapping URL comment
sed -i.bak -e "s@/\*# sourceMappingURL=bootstrap\.css\.map.*@@g" ${DIST}/css/bootstrap.css
rm -f ${DIST}/css/bootstrap.css.bak
# Generate css
cat ./node_modules/bootstrap/dist/css/bootstrap.css \
@ -86,6 +87,12 @@ tar -cvzf ./dist/${VERSION}.tar.gz -C ${DIST} .
# Copy index.html for testing
sed -e "s/VERSION/"${VERSION}"/g" ./index.html.tmpl > ./dist/index.html
# Generate versions file
COMMIT=$(git rev-parse --short HEAD)
sed -e "s/VERSION/"${VERSION}"/g" ./version.json.tmpl > ${DIST}/version.json
sed -i.bak -e "s/COMMIT/"${COMMIT}"/g" ${DIST}/version.json
rm -f ${DIST}/version.json.bak
echo ""
echo "All done"
echo ""

4
version.json.tmpl Normal file
View File

@ -0,0 +1,4 @@
{
"version": "VERSION",
"commit": "COMMIT"
}