62 lines
2.2 KiB
YAML
62 lines
2.2 KiB
YAML
name: Build image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
image:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: gitea/runner-images:ubuntu-latest
|
|
# den Docker-Socket haengt der Runner selbst ein, ein zweiter Mount
|
|
# waere ein "Duplicate mount point"
|
|
options: -v /home/jazz/stacks:/deploy-target
|
|
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:
|
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
REGISTRY_USER: ${{ vars.REGISTRY_USER }}
|
|
ACTOR: ${{ gitea.actor }}
|
|
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 "${REGISTRY_USER:-$ACTOR}" --password-stdin
|
|
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)"
|
|
|
|
- name: wordarr im arr-Stack neu ziehen
|
|
run: |
|
|
mountpoint -q /deploy-target || {
|
|
echo "::error::/deploy-target ist nicht gemountet - valid_volumes im act_runner pruefen"
|
|
exit 1
|
|
}
|
|
if docker compose version >/dev/null 2>&1; then
|
|
compose="docker compose"
|
|
elif command -v docker-compose >/dev/null 2>&1; then
|
|
compose="docker-compose"
|
|
else
|
|
apt-get update -qq && apt-get install -y -qq docker-compose-v2
|
|
compose="docker compose"
|
|
fi
|
|
cd /deploy-target/arr
|
|
$compose pull wordarr # ohne pull bleibt :latest das alte Image
|
|
$compose up -d wordarr
|
|
echo "Laeuft:"
|
|
docker inspect -f '{{.Config.Image}} seit {{.State.StartedAt}}' wordarr
|