Created
December 29, 2020 18:09
-
-
Save jakejarvis/c22bd09f5df77707787ae8c64ef0a03c to your computer and use it in GitHub Desktop.
Download and install latest Gitea binary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Download and install latest Gitea binary | |
set -euo pipefail | |
GITEA_BINARY=/usr/bin/gitea | |
# Set working directory to location of this script | |
cd "${0%/*}" || exit | |
echo "* Downloading the latest release..." | |
VERSION=$(curl --silent https://api.github.com/repos/go-gitea/gitea/releases/latest | grep '"tag_name":' | cut -d'"' -f4 | sed 's/v//') | |
curl -sS -L https://github.com/go-gitea/gitea/releases/download/v${VERSION}/gitea-${VERSION}-linux-amd64 -o gitea | |
echo "* New version downloaded, swapping out binaries..." | |
# Stop Gitea | |
systemctl stop gitea | |
# Back up old binary | |
mv "$GITEA_BINARY" ./gitea.bak | |
# Move new release to /usr/bin | |
mv ./gitea "$GITEA_BINARY" | |
chmod +x "$GITEA_BINARY" | |
# Restart Gitea service with new version | |
systemctl start gitea | |
rm ./gitea.bak | |
echo "* Success!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment