Page:
Gitea1.15.6更新操作手册
Table of Contents
This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Gitea更新操作手册
-
安装go,版本1.20.2
wget https://golang.google.cn/dl/go1.20.2.linux-amd64.tar.gz tar -C /usr/local -xzf go1.20.2.linux-amd64.tar.gz export PATH=$PATH:/usr/local/go/bin
-
手动cp options templates public到/var/lib/gitea/下
git clone https://gitlink.org.cn/Gitlink/gitea_hat.git # 需要确定分支,测试环境使用develop,正式环境使用master cp -r gitea_hat/options /var/lib/gitea/ cp -r gitea_hat/templates /var/lib/gitea/ cp -r gitea_hat/public /var/lib/gitea/
-
到项目目录下打包gitea文件
cd gitea_hat/ go mod tidy go mod vendor go build -o gitea main.go
-
替换/usr/local/bin/下的gitea二进制文件
cp gitea /usr/local/bin/
-
编写update.sh上线脚本
#!/bin/bash . ~/.bash_profile cd /root/gitea_hat Branch=master git remote set-url origin https://gitlink.org.cn/Gitlink/gitea_hat.git git fetch origin if [ "$?" -eq "0" ]; then echo -e "\e[1;42m git fetch succssed \e[0m" else git reset --hard FETCH_HEAD git fetch origin echo -e "\e[1;42m git fetch succssed \e[0m" fi #chechkout master git checkout $Branch if [ "$?" -eq "0" ];then echo -e "\e[1;42m checkout develop succssed \e[0m" else git reset --hard FETCH_HEAD git checkout $Branch echo -e "\e[1;42m checkout develop succssed \e[0m" fi #git pull git pull if [ "$?" -eq "0" ];then echo -e "\e[1;42m git pull succssed \e[0m" else git reset --hard FETCH_HEAD git pull echo -e "\e[1;42m git pull succssed \e[0m" fi # go mod tidy go mod tidy if [ "$?" -eq "0" ];then echo -e "\e[1;42m go mod tidy succssed \e[0m" else echo -e "\e[1;42m go mod tidy FAILED! \e[0m" fi # go mod vendor go mod vendor if [ "$?" -eq "0" ];then echo -e "\e[1;42m go mod vendor succssed \e[0m" else echo -e "\e[1;42m go mod vendor FAILED! \e[0m" fi # build share go build -o gitea main.go if [ "$?" -eq "0" ];then echo -e "\e[1;42m go build -o share main.go succssed \e[0m" else echo -e "\e[1;31m go build -o share FAILED! \e[0m" fi # systemctl stop gitea systemctl stop gitea if [ "$?" -eq "0" ];then echo -e "\e[1;42m systemctl stop gitea succssed \e[0m" else echo -e "\e[1;31m systemctl stop gitea FAILED! \e[0m" fi # cp gitea to /usr/local/bin cp gitea /usr/local/bin if [ "$?" -eq "0" ];then echo -e "\e[1;42m cp gitea to /usr/local/bin succssed \e[0m" else echo -e "\e[1;31m cp gitea to /usr/local/bin FAILED! \e[0m" fi # systemctl start gitea systemctl start gitea if [ "$?" -eq "0" ];then echo -e "\e[1;42m systemctl start gitea succssed \e[0m" else echo -e "\e[1;31m systemctl start gitea FAILED! \e[0m" fi