commit db1ccbb3b62d3c8e4de2629d0957ca810acf1c6b Author: Nulo Date: Mon Jan 30 16:16:41 2023 -0300 kdkaskaldsjfalkds diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a142737 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +rootfs/ +cache/ diff --git a/instalar-gitea b/instalar-gitea new file mode 100644 index 0000000..bde3ad8 --- /dev/null +++ b/instalar-gitea @@ -0,0 +1,9 @@ +#!/bin/sh +# Editar en https://gitea.nulo.in/Nulo/forgejo-updater si se cambia +bin=/usr/local/bin/gitea +new=/usr/local/bin/gitea.new +rm "$new" +cat /dev/stdin > "$new" || exit $? +chmod +x "$new" || exit $? +mv "$new" "$bin" || exit $? +sv restart gitea || exit $? diff --git a/repro-run.json b/repro-run.json new file mode 100644 index 0000000..0420826 --- /dev/null +++ b/repro-run.json @@ -0,0 +1,4 @@ +{ + "Command": "/src/update-forgejo", + "Cache": ["/home/repro/.cache/go-build", "/home/repro/go", "/home/repro/.npm"] +} diff --git a/update-forgejo b/update-forgejo new file mode 100755 index 0000000..d79a8a4 --- /dev/null +++ b/update-forgejo @@ -0,0 +1,28 @@ +#!/bin/sh -e + +runprint() { + echo "==> $@" + "$@" +} + +runprint apk add --quiet git nodejs npm go make + +# TODO: cachear clon de repo +runprint git clone https://codeberg.org/forgejo/forgejo --branch v1.18.2-1 --depth 1 --single-branch +cd forgejo + +runprint env GOOS=linux GOARCH=amd64 LDFLAGS="-linkmode external -extldflags '-static' $LDFLAGS" TAGS="bindata sqlite sqlite_unlock_notify" make build + +runprint apk add --quiet rsync openssh-client-default + +if test -n "$SSH_KEY"; then + eval $(ssh-agent -s) + # https://stackoverflow.com/questions/46147228/dotenv-multiline-variables + echo "${SSH_KEY}" | tr -d '\r' | ssh-add - + mkdir -p ~/.ssh + echo "[nulo.in]:420,[186.136.121.7]:420 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGPkgRVWYcVcgjI0xAjDgZQsYuXU9edcya8zna01ibyUMlfKHIMD9yOoq0R+fQPTCqwiol/2tKMPJ2hlKshc+H8=" > ~/.ssh/known_hosts + + runprint ssh -p420 ci-gitea@nulo.in doas /usr/local/sbin/instalar-gitea < forgejo +else + echo ==> No tengo SSH_KEY, no voy a actualizar el binario. +fi