Skip to content

Commit

Permalink
Update create-release.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
TychoTheTaco committed Aug 5, 2022
1 parent fe42515 commit cf87627
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions tools/create-release.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
#
# Builds and uploads docker images to GitHub container registry for a new release using the latest commit from the master branch.
#

currentDirectory=$(dirname "$0")

isWindows() {
if [[ "$(uname)" == MINGW32_NT* ]]; then
return 0
elif [[ "$(uname)" == MINGW64_NT* ]]; then
return 0
fi
return 1
}

isDockerRunning() {
if docker version >/dev/null 2>&1; then
return 0
fi
return 1
}

personalAccessToken=$1
if [ -z "${personalAccessToken}" ]; then
echo "Missing GitHub personal access token! Visit https://github.com/settings/tokens/new to create one. Must have \"write:packages\" permission."
Expand Down Expand Up @@ -58,6 +75,19 @@ fi
scriptDirectory="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &>/dev/null && pwd 2>/dev/null)"
projectDirectory="$(cd "$scriptDirectory/../" && pwd)"

# Make sure docker is running
if isWindows; then
if ! isDockerRunning; then
echo "Docker not running! Starting it now..."
"/c/Program Files/Docker/Docker/Docker Desktop.exe" &
while ! isDockerRunning; do
echo "Waiting for Docker..."
sleep 5
done
echo "Done."
fi
fi

# Build and push docker image
docker buildx build \
--platform linux/amd64,linux/arm64/v8,linux/arm/v7 \
Expand All @@ -69,6 +99,8 @@ docker buildx build \

# Tag the commit with the version number
echo "Tagging commit with version code..."
git tag v"$currentVersion" "$hash"
tagName=v"$currentVersion"
git tag "$tagName" "$hash"
git push origin "$tagName"

echo "Done!"
echo "Done!"

0 comments on commit cf87627

Please sign in to comment.