mirror of
https://code.forgejo.org/actions/setup-forgejo.git
synced 2024-11-27 08:40:57 -05:00
no longer use /usr/local/bin
This commit is contained in:
parent
f147de9c79
commit
418489ad4f
4 changed files with 15 additions and 13 deletions
|
@ -48,7 +48,7 @@ jobs:
|
|||
LXC_IP_PREFIX=10.0.10 forgejo-dependencies.sh
|
||||
|
||||
forgejo-binary.sh ensure_user forgejo
|
||||
chown forgejo $DIR /usr/local/bin
|
||||
chown forgejo $DIR
|
||||
su -c "DIR=$DIR bash -x forgejo-binary.sh setup root admin1234 ${{ matrix.binary }}" forgejo
|
||||
|
||||
su -c "DIR=$DIR bash -x forgejo-runner.sh setup" forgejo
|
||||
|
|
|
@ -98,7 +98,7 @@ runs:
|
|||
fi
|
||||
if test "${{ inputs.binary }}"; then
|
||||
forgejo-binary.sh ensure_user forgejo
|
||||
chown forgejo $(pwd) /usr/local/bin
|
||||
chown forgejo $(pwd)
|
||||
su -c "DIR=$(pwd) forgejo-binary.sh setup ${{ inputs.user }} ${{ inputs.password }} ${{ inputs.binary }}" forgejo
|
||||
su -c "DIR=$(pwd) forgejo-runner.sh setup ${{ inputs.runner }} ${{ inputs.runner-version }} $(cat forgejo-url)" forgejo
|
||||
else
|
||||
|
|
|
@ -66,16 +66,18 @@ function checkout() {
|
|||
function build_runner() {
|
||||
local git="$1"
|
||||
local version="${2:-main}"
|
||||
local dir=$(mktemp -d)
|
||||
local dir="$3"
|
||||
|
||||
local tmp=$(mktemp -d)
|
||||
(
|
||||
cd $dir
|
||||
cd $tmp
|
||||
checkout "$git"
|
||||
dependency_go
|
||||
cd forgejo-runner
|
||||
git checkout "$version"
|
||||
make build
|
||||
)
|
||||
mv $dir/forgejo-runner/forgejo-runner /usr/local/bin
|
||||
mv $tmp/forgejo-runner/forgejo-runner $dir
|
||||
forgejo-runner --version
|
||||
rm -fr "$dir"
|
||||
rm -fr "$tmp"
|
||||
}
|
||||
|
|
|
@ -20,12 +20,12 @@ function download() {
|
|||
local runner_repository="$1"
|
||||
local version="$2"
|
||||
|
||||
if ! which forgejo-runner > /dev/null; then
|
||||
if ! curl -L --fail -sS $runner_repository/releases/download/$version/forgejo-runner-${version#v}-linux-amd64 > /usr/local/bin/forgejo-runner ; then
|
||||
if ! which $DIR/forgejo-runner > /dev/null; then
|
||||
if ! curl -L --fail -sS $runner_repository/releases/download/$version/forgejo-runner-${version#v}-linux-amd64 > $DIR/forgejo-runner ; then
|
||||
# backward compatibility for for the naming scheme prior to 3.0.0
|
||||
curl -L --fail -sS $runner_repository/releases/download/$version/forgejo-runner-linux-amd64 > /usr/local/bin/forgejo-runner
|
||||
curl -L --fail -sS $runner_repository/releases/download/$version/forgejo-runner-linux-amd64 > $DIR/forgejo-runner
|
||||
fi
|
||||
chmod 755 /usr/local/bin/forgejo-runner
|
||||
chmod 755 $DIR/forgejo-runner
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ function register() {
|
|||
$DIR/forgejocli actions generate-runner-token | tee $DIR/forgejo-runner-token
|
||||
(
|
||||
cd $DIR
|
||||
timeout --signal=KILL 30 forgejo-runner register --no-interactive --instance "$forgejo" --name runner --token $(cat $DIR/forgejo-runner-token) --labels docker:docker://code.forgejo.org/oci/node:20-bookworm,ubuntu-latest:docker://code.forgejo.org/oci/node:20-bookworm,self-hosted:lxc://debian:bookworm
|
||||
timeout --signal=KILL 30 $DIR/forgejo-runner register --no-interactive --instance "$forgejo" --name runner --token $(cat $DIR/forgejo-runner-token) --labels docker:docker://code.forgejo.org/oci/node:20-bookworm,ubuntu-latest:docker://code.forgejo.org/oci/node:20-bookworm,self-hosted:lxc://debian:bookworm
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ function run() {
|
|||
daemon --chdir=$DIR --unsafe \
|
||||
--env="TERM=$TERM" --env="HOME=$(cat $DIR/forgejo-runner-home)" --env="PATH=$PATH" --env="USER=$USER" --env="TERM=dumb" --env="USERNAME=$USERNAME" --env="LANG=$LANG" \
|
||||
--pidfile=$DIR/forgejo-runner-pid --errlog=$DIR/forgejo-runner.log --output=$DIR/forgejo-runner.log -- \
|
||||
forgejo-runner --config $FORGEJO_RUNNER_CONFIG daemon
|
||||
$DIR/forgejo-runner --config $FORGEJO_RUNNER_CONFIG daemon
|
||||
sleep 1
|
||||
cat $DIR/forgejo-runner.log
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ function setup() {
|
|||
dependencies
|
||||
if [[ "$version" =~ ^@ ]] ; then
|
||||
local branch=${version##@}
|
||||
build_runner $runner_repository $branch
|
||||
build_runner $runner_repository $branch $DIR
|
||||
else
|
||||
download $runner_repository $version
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue