diff options
author | 0neGal <mail@0negal.com> | 2022-05-02 21:49:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-02 21:49:20 +0200 |
commit | c40e331bdc4b2375d3802a515c9b7a032118dea7 (patch) | |
tree | 77c8d84c0fc9d0fbb742cfeeb80efa4762784a9d /build/publish.sh | |
parent | 9f2f77558238c28ceb8ff4fca2096602671779e5 (diff) | |
parent | 847a2178e7823749e3096daf24dfcd3df8b236cb (diff) | |
download | Viper-c40e331bdc4b2375d3802a515c9b7a032118dea7.tar.gz Viper-c40e331bdc4b2375d3802a515c9b7a032118dea7.zip |
Merge branch 'main' into enabledmods
Diffstat (limited to 'build/publish.sh')
-rwxr-xr-x | build/publish.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/build/publish.sh b/build/publish.sh new file mode 100755 index 0000000..042b7c1 --- /dev/null +++ b/build/publish.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +VERSION="v$(jq '.version' package.json -r)" +LOCK1="v$(jq '.version' package-lock.json -r)" +LOCK2="v$(jq '.packages[""].version' package-lock.json -r)" + +REPO="$(jq '.repository.url' package.json -r | sed 's/.*.com\///g')" + +REMOTEVERSION="$(curl --silent "https://api.github.com/repos/0neGal/viper/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')" + +[ "$REMOTEVERSION" = "$VERSION" ] && { + echo "A release already exists with the current version number!" + exit 1 +} + +[ "$VERSION" != "$LOCK1" ] && { + echo "Two seperate version numbers in package.json and package-lock.json" + echo " $VERSION, $LOCK1" + exit 1 +} + +[ "$LOCK1" != "$LOCK2" ] && { + echo "Version mismatches in package-lock.json" + echo " $LOCK1, $LOCK2" + exit 1 +} + + +node build/langs.js || { + echo "Please fix localization errors before publishing..." + exit 1 +} + +TOKEN="$GH_TOKEN" + +[ "$TOKEN" = "" ] && { + echo "GH_TOKEN is not set, please type it below:" + read -p "> " TOKEN +} + +GH_TOKEN="$TOKEN" npm run publish |