From b2ba9a2fcbaa679fab3d98feef7a9edc4cd4548a Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Sun, 30 Aug 2020 12:03:28 -0700 Subject: [PATCH] Add the argument release to build script to actually release --- scripts/build.sh | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 36f3fd5d0..a0738d6b0 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -9,6 +9,7 @@ ARCH=(amd64 amd64) # Version VERSION=$1 +SHOULD_RELEASE=$2 if [[ -z "${VERSION}" ]]; then echo "Version must be specified when running build" @@ -64,29 +65,35 @@ for i in "${!DISTRO[@]}"; do build ${DISTRO[$i]} ${OS[$i]} ${ARCH[$i]} $VERSION $GIT_COMMIT done -# Create the tag -# git tag -a "v${VERSION}" -m "Release build v${VERSION}" +# Use the second argument "release" to create an actual release. +if [ "$SHOULD_RELEASE" != "release" ]; then + echo "Not creating a release." + exit +fi -# # On macOS open the Github page for new releases so they can be uploaded -# if test -f "/usr/bin/open"; then -# open "https://github.com/gabek/owncast/releases/new" -# open dist -# fi +# Create the tag +git tag -a "v${VERSION}" -m "Release build v${VERSION}" + +# On macOS open the Github page for new releases so they can be uploaded +if test -f "/usr/bin/open"; then + open "https://github.com/gabek/owncast/releases/new" + open dist +fi # Docker build # Must authenticate first: https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages#authenticating-to-github-packages -# DOCKER_IMAGE="owncast-${VERSION}" -# echo "Building Docker image ${DOCKER_IMAGE}..." -# -# # Change to the root directory of the repository -# cd $(git rev-parse --show-toplevel) -# +DOCKER_IMAGE="owncast-${VERSION}" +echo "Building Docker image ${DOCKER_IMAGE}..." + +# Change to the root directory of the repository +cd $(git rev-parse --show-toplevel) + # Github Packages -# docker build --build-arg NAME=docker --build-arg VERSION=${VERSION} --build-arg GIT_COMMIT=$GIT_COMMIT -t owncast . -f scripts/Dockerfile-build -# docker tag $DOCKER_IMAGE docker.pkg.github.com/gabek/owncast/$DOCKER_IMAGE:$VERSION -# docker push docker.pkg.github.com/gabek/owncast/$DOCKER_IMAGE:$VERSION +docker build --build-arg NAME=docker --build-arg VERSION=${VERSION} --build-arg GIT_COMMIT=$GIT_COMMIT -t owncast . -f scripts/Dockerfile-build +docker tag $DOCKER_IMAGE docker.pkg.github.com/gabek/owncast/$DOCKER_IMAGE:$VERSION +docker push docker.pkg.github.com/gabek/owncast/$DOCKER_IMAGE:$VERSION # # Dockerhub # You must be authenticated via `docker login` with your Dockerhub credentials first. -# docker tag owncast gabekangas/owncast:$VERSION -# docker push gabekangas/owncast \ No newline at end of file +docker tag owncast gabekangas/owncast:$VERSION +docker push gabekangas/owncast