Forgejo >= v1.19.0-3 needs repo.actions

Fixes: https://code.forgejo.org/actions/setup-forgejo/issues/3
This commit is contained in:
Earl Warren 2023-04-05 17:40:06 +02:00
parent 563dcf409d
commit 89ed6c5186
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
5 changed files with 36 additions and 8 deletions

View 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

View file

@ -7,7 +7,7 @@ jobs:
- run: | - run: |
set -x set -x
LXC_IP_PREFIX=10.0.9 ./forgejo-dependencies.sh 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. # Uncomment the following for a shortcut to debugging the Forgejo runner.
# It will build the runner from a designated repository and branch instead of # It will build the runner from a designated repository and branch instead of

View file

@ -80,7 +80,7 @@ runs:
cd $(mktemp -d) cd $(mktemp -d)
LXC_IP_PREFIX=${{ inputs.lxc-ip-prefix }} forgejo-dependencies.sh LXC_IP_PREFIX=${{ inputs.lxc-ip-prefix }} forgejo-dependencies.sh
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/
echo url="http://$(cat forgejo-ip):3000" >> $GITHUB_OUTPUT echo url="http://$(cat forgejo-ip):3000" >> $GITHUB_OUTPUT
echo host-port="$(cat forgejo-ip):3000" >> $GITHUB_OUTPUT echo host-port="$(cat forgejo-ip):3000" >> $GITHUB_OUTPUT

View file

@ -43,4 +43,4 @@ function setup() {
install_lxc install_lxc
} }
setup "${@:-setup}"

View file

@ -4,7 +4,6 @@
set -e set -e
if ${VERBOSE:-false}; then set -x; fi if ${VERBOSE:-false}; then set -x; fi
: ${CONTAINER:=forgejo} : ${CONTAINER:=forgejo}
function wait_for() { function wait_for() {
@ -27,6 +26,13 @@ function wait_for() {
function run() { function run() {
local image="$1" 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} \ docker run --restart unless-stopped --name ${CONTAINER} \
-e "RUN_MODE=dev" \ -e "RUN_MODE=dev" \
@ -35,8 +41,8 @@ function run() {
-e "FORGEJO__actions__ENABLED=true" \ -e "FORGEJO__actions__ENABLED=true" \
-e "FORGEJO__repository__ENABLE_PUSH_CREATE_USER=true" \ -e "FORGEJO__repository__ENABLE_PUSH_CREATE_USER=true" \
-e "FORGEJO__repository__DEFAULT_PUSH_CREATE_PRIVATE=false" \ -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" \ -e "FORGEJO__repository__DEFAULT_REPO_UNITS=repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki,repo.projects,repo.packages,$actions_unit" \
-d $image -d $image:$version
local ip="$(docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" ${CONTAINER})" local ip="$(docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" ${CONTAINER})"
echo $ip > forgejo-ip echo $ip > forgejo-ip
docker exec ${CONTAINER} sed -i -e "s|localhost|$ip|" /data/gitea/conf/app.ini docker exec ${CONTAINER} sed -i -e "s|localhost|$ip|" /data/gitea/conf/app.ini
@ -46,9 +52,10 @@ function run() {
function setup() { function setup() {
local user="${1:-root}" local user="${1:-root}"
local password="${2:-admin1234}" 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 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 if docker exec --user 1000 ${CONTAINER} forgejo admin user list --admin | grep "$user" ; then