From 6493d15c52c9be7727950515a331ef479050a2b9 Mon Sep 17 00:00:00 2001 From: Steppenstreuner Date: Tue, 1 Sep 2026 17:59:33 +0200 Subject: [PATCH] add(ci): build and push the image on every push to main --- .gitea/workflows/build.yml | 37 +++++++++++++++++++++++++++++++++++++ README.md | 8 ++++++++ 2 files changed, 45 insertions(+) create mode 100644 .gitea/workflows/build.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..9a826c6 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,37 @@ +name: Build image + +on: + push: + branches: + - main + +jobs: + image: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Tests + run: | + python3 -m venv /tmp/venv + /tmp/venv/bin/pip install --quiet -e .[dev] + /tmp/venv/bin/python -m pytest -q # the browser tests skip without playwright + + - name: Image bauen und pushen + env: + # GITEA_TOKEN reicht, wenn der Runner Packages schreiben darf; + # sonst ein PAT mit package:write als Secret REGISTRY_TOKEN hinterlegen. + REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + run: | + command -v docker >/dev/null || { apt-get update -qq && apt-get install -y -qq docker.io; } + sha=$(git rev-parse --short HEAD) + image=gitea.steppencloud.de/admin/wordarr + token=${REGISTRY_TOKEN:-$GITEA_TOKEN} + echo "$token" | docker login gitea.steppencloud.de -u "${{ gitea.actor }}" --password-stdin + # der sha landet als Build-Stempel neben der Version im UI + docker build --build-arg WORDARR_BUILD="$sha" -t "$image:$sha" -t "$image:latest" . + docker push "$image:$sha" + docker push "$image:latest" + echo "Gepusht: $image:latest ($sha)" diff --git a/README.md b/README.md index 342c338..aee95a9 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,14 @@ same three values. Build with the git sha via The UI speaks German and English; the button next to the navigation switches between them and remembers the choice. Without one, the browser language decides. +## Build + +`.gitea/workflows/build.yml` runs the tests on every push to `main` and then +builds and pushes `gitea.steppencloud.de/admin/wordarr` as `:latest` and +`:`, passing that sha as `WORDARR_BUILD`. It logs in with +`REGISTRY_TOKEN` if the secret exists, otherwise with the runner's own +`GITEA_TOKEN`. Rolling the new image out stays a manual step (dockhand). + ## Usage 1. **Libraries** – create one per target folder with a media type, a naming