add(ci): build and push the image on every push to main
Build image / image (push) Successful in 50s
Build image / image (push) Successful in 50s
This commit is contained in:
@@ -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)"
|
||||
@@ -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
|
||||
`:<short sha>`, 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
|
||||
|
||||
Reference in New Issue
Block a user