Skip to content

Commit

Permalink
update version number and update create-release.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
TychoTheTaco committed May 1, 2022
1 parent 2b7df9d commit 88693c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "twitch_drops_bot",
"version": "1.0.1",
"version": "1.1.0",
"description": "A Node.js bot for automatically collecting Twitch drops.",
"type": "module",
"repository": {
Expand Down
15 changes: 8 additions & 7 deletions tools/create-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ if [ -z "${personalAccessToken}" ]; then
exit 1
fi

versionTag=$2
if [ -z "${versionTag}" ]; then
echo "Missing version versionTag!"
# Read the current version from package.json
currentVersion=$(cat ../package.json | grep '"version": "' | grep -o '[0-9|\.]\+')
if [ -z "${currentVersion}" ]; then
echo "Failed to read current version from package.json!"
exit 1
fi

# Make sure the version code has been updated
response=$(curl -s https://api.github.com/repos/tychothetaco/twitch-drops-bot/releases?per_page=1)
latestVersion=$(echo "$response" | grep '"tag_name": "v\([0-9]\+\.\)\+[0-9]\+"' | grep -o 'v[0-9|\.]\+')
latestVersion=$(echo "$response" | grep '"tag_name": "v\([0-9]\+\.\)\+[0-9]\+"' | grep -o '[0-9|\.]\+')
if [ -z "$latestVersion" ]; then
echo "Failed to get latest version!"
echo "$response"
fi
if [ "$latestVersion" = "$versionTag" ]; then
if [ "$latestVersion" = "$currentVersion" ]; then
echo "Current version matches latest version! Did you forget to update the version number in package.json?"
exit 1
fi
Expand All @@ -46,7 +47,7 @@ confirm() {
esac
}

echo "About to build and push version $versionTag"
echo "About to build and push version $currentVersion"
if ! confirm; then
echo "Aborted by user."
exit 2
Expand All @@ -55,7 +56,7 @@ fi
# Build and push docker image
docker buildx build \
--platform linux/amd64,linux/arm64/v8,linux/arm/v7 \
--tag ghcr.io/tychothetaco/twitch-drops-bot:"$versionTag" \
--tag ghcr.io/tychothetaco/twitch-drops-bot:v"$currentVersion" \
--tag ghcr.io/tychothetaco/twitch-drops-bot:latest-release \
--build-arg GIT_COMMIT_HASH="$hash" \
--output type=registry \
Expand Down

0 comments on commit 88693c7

Please sign in to comment.