Merge pull request 'implement install-only' (#74) from earl-warren/setup-forgejo:wip-install-only into main

Reviewed-on: https://code.forgejo.org/actions/setup-forgejo/pulls/74
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
This commit is contained in:
earl-warren 2023-10-28 21:58:29 +00:00
commit a521fd2935
2 changed files with 8 additions and 0 deletions

View file

@ -45,6 +45,7 @@ It can only be run on the `self-hosted` platform, running on a host with LXC ins
| runner-version | Runner version | `false` | v3.0.1 | | runner-version | Runner version | `false` | v3.0.1 |
| container | Name of the container running the Forgejo instance | `false` | forgejo | | container | Name of the container running the Forgejo instance | `false` | forgejo |
| lxc-ip-prefix | Class C IP prefix used by LXC | `false` | 10.0.23 | | lxc-ip-prefix | Class C IP prefix used by LXC | `false` | 10.0.23 |
| install-only | Only install Forgejo and the Forgejo runner, do not launch them | `false` | false |
<!-- action-docs-inputs --> <!-- action-docs-inputs -->

View file

@ -53,6 +53,9 @@ inputs:
lxc-ip-prefix: lxc-ip-prefix:
description: 'Class C IP prefix used by LXC' description: 'Class C IP prefix used by LXC'
default: '10.0.23' default: '10.0.23'
install-only:
description: 'Only install Forgejo and the Forgejo runner, do not launch them'
default: 'false'
outputs: outputs:
url: url:
description: "URL of the Forgejo instance" description: "URL of the Forgejo instance"
@ -81,6 +84,10 @@ runs:
cd $(mktemp -d) cd $(mktemp -d)
cp ${{ github.action_path }}/runner-config.yaml . cp ${{ github.action_path }}/runner-config.yaml .
LXC_IP_PREFIX=${{ inputs.lxc-ip-prefix }} forgejo-dependencies.sh LXC_IP_PREFIX=${{ inputs.lxc-ip-prefix }} forgejo-dependencies.sh
if ${{ inputs.install-only }} ; then
echo "install-only is true, do not run Forgejo"
exit 0
fi
export CONTAINER=${{ inputs.container }} export CONTAINER=${{ inputs.container }}
forgejo.sh setup ${{ inputs.user }} "${{ inputs.password }}" ${{ inputs.image }} ${{ inputs.image-version }} forgejo.sh setup ${{ inputs.user }} "${{ inputs.password }}" ${{ inputs.image }} ${{ inputs.image-version }}
forgejo-runner.sh setup ${{ inputs.runner }} ${{ inputs.runner-version }} http://$(cat forgejo-ip):3000/ forgejo-runner.sh setup ${{ inputs.runner }} ${{ inputs.runner-version }} http://$(cat forgejo-ip):3000/