mirror of
https://code.forgejo.org/actions/setup-forgejo.git
synced 2024-11-23 23:21:03 -05:00
Forgejo >= v1.19.0-3 needs repo.actions
Fixes: https://code.forgejo.org/actions/setup-forgejo/issues/3
This commit is contained in:
parent
563dcf409d
commit
89ed6c5186
5 changed files with 36 additions and 8 deletions
21
.forgejo/workflows/forgejo-sh.yml
Normal file
21
.forgejo/workflows/forgejo-sh.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
on:
|
||||
push:
|
||||
paths:
|
||||
- forgejo.sh
|
||||
pull_request:
|
||||
paths:
|
||||
- forgejo.sh
|
||||
|
||||
jobs:
|
||||
forgejo-sh:
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: |
|
||||
set -x
|
||||
./forgejo-dependencies.sh install_docker
|
||||
for version in 1.19.0-2 1.19.0-3; do
|
||||
echo "=========================== launching forgejo v$version =========="
|
||||
./forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo $version
|
||||
./forgejo.sh teardown
|
||||
done
|
|
@ -7,7 +7,7 @@ jobs:
|
|||
- run: |
|
||||
set -x
|
||||
LXC_IP_PREFIX=10.0.9 ./forgejo-dependencies.sh
|
||||
./forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo:1.19
|
||||
./forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo 1.19
|
||||
#
|
||||
# Uncomment the following for a shortcut to debugging the Forgejo runner.
|
||||
# It will build the runner from a designated repository and branch instead of
|
||||
|
|
|
@ -80,7 +80,7 @@ runs:
|
|||
cd $(mktemp -d)
|
||||
LXC_IP_PREFIX=${{ inputs.lxc-ip-prefix }} forgejo-dependencies.sh
|
||||
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/
|
||||
echo url="http://$(cat forgejo-ip):3000" >> $GITHUB_OUTPUT
|
||||
echo host-port="$(cat forgejo-ip):3000" >> $GITHUB_OUTPUT
|
||||
|
|
|
@ -43,4 +43,4 @@ function setup() {
|
|||
install_lxc
|
||||
}
|
||||
|
||||
setup
|
||||
"${@:-setup}"
|
||||
|
|
17
forgejo.sh
17
forgejo.sh
|
@ -4,7 +4,6 @@
|
|||
set -e
|
||||
|
||||
if ${VERBOSE:-false}; then set -x; fi
|
||||
|
||||
: ${CONTAINER:=forgejo}
|
||||
|
||||
function wait_for() {
|
||||
|
@ -27,6 +26,13 @@ function wait_for() {
|
|||
|
||||
function run() {
|
||||
local image="$1"
|
||||
local version="$2"
|
||||
|
||||
if dpkg --compare-versions "$version" "lt" "1.19.0-3"; then
|
||||
actions_unit="actions.actions"
|
||||
else
|
||||
actions_unit="repo.actions"
|
||||
fi
|
||||
|
||||
docker run --restart unless-stopped --name ${CONTAINER} \
|
||||
-e "RUN_MODE=dev" \
|
||||
|
@ -35,8 +41,8 @@ function run() {
|
|||
-e "FORGEJO__actions__ENABLED=true" \
|
||||
-e "FORGEJO__repository__ENABLE_PUSH_CREATE_USER=true" \
|
||||
-e "FORGEJO__repository__DEFAULT_PUSH_CREATE_PRIVATE=false" \
|
||||
-e "FORGEJO__repository__DEFAULT_REPO_UNITS=repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki,repo.projects,repo.packages,actions.actions" \
|
||||
-d $image
|
||||
-e "FORGEJO__repository__DEFAULT_REPO_UNITS=repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki,repo.projects,repo.packages,$actions_unit" \
|
||||
-d $image:$version
|
||||
local ip="$(docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" ${CONTAINER})"
|
||||
echo $ip > forgejo-ip
|
||||
docker exec ${CONTAINER} sed -i -e "s|localhost|$ip|" /data/gitea/conf/app.ini
|
||||
|
@ -46,9 +52,10 @@ function run() {
|
|||
function setup() {
|
||||
local user="${1:-root}"
|
||||
local password="${2:-admin1234}"
|
||||
local image="${3:-codeberg.org/forgejo/forgejo:1.19}"
|
||||
local image="${3:-codeberg.org/forgejo/forgejo}"
|
||||
local version="${4:-1.19}"
|
||||
|
||||
run $image
|
||||
run $image $version
|
||||
|
||||
sleep 5 # for some reason trying to run "forgejo admin" while forgejo is booting will permanently break everything
|
||||
if docker exec --user 1000 ${CONTAINER} forgejo admin user list --admin | grep "$user" ; then
|
||||
|
|
Loading…
Reference in a new issue