Introduction
I have a Gitea server on OpenBSD.
Here is how to update it via command line.
Summary
The way is simple.
Stop the service, git fetch the latest tag, build the newer binary (with the same name) which will be replaced the current automatically, and start the service again.
# rcctl stop <gitea-daemon>
$ cd <gitea-dir>
$ git fetch --tags
From https://github.com/go-gitea/gitea
...
* [new tag] vX.X.X -> vX.X.X
$ #or: git tag | tail # the latest release will be shown as vX.X.X
$ git checkout vX.X.X
# chown -R <update-user>: ./{data,gitea-repositories,log}
$ env TAGS="bindata" make -f BSDmakefile generate build
$ # or use GNU make
$ #env TAGS="bindata" gmake generate build
$ # ---
$ # use `max_old_space_size` option in Node.js in case that server has small memory
$ #env TAGS="bindata" NODE_OPTIONS="--max_old_space_size=1024" make -f BSDmakefile generate build
# chown -R <gitea-user>: ./{data,gitea-repositories,log}
# rcctl start <gitea-daemon>
Steb-by-step descriptions
First of all, stop the Gitea service carefully.
in <gitea-dir>
Just for the reference, you can get the latest version via command line:
$ git describe --tags
v1.13.1
and it's also possible to show all:
$ git tag -l
...
v1.12.x
...
v1.13.1
...
Besides, as to branches:
$ git branch -l
* (HEAD detached at v1.13.0)
master
Well, let's begin to update tags list:
$ git fetch --tags
$ git checkout v1.13.1
If you have changed permission when building the Gitea server, change them temporarily:
$ chown -R <update-user>: ./{data,gitea-repositories,log}
and then build the newer binary, which takes a minute or more:
$ env TAGS="bindata" make -f BSDmakefile generate build
$ # or use GNU make
$ #env TAGS="bindata" gmake generate build
$ # ---
$ # use `max_old_space_size` option in Node.js in case that server has small memory
$ #env TAGS="bindata" NODE_OPTIONS="--max_old_space_size=1024" make -f BSDmakefile generate build
...
writing bindata.go
...
If the permission has been changed beforehand in this process, revert them:
$ chown -R <gitea-user>: ./{data,gitea-repositories,log}
Now the gitea executable binary has been updated.
Start the service again :)