Matches the pattern used by Dashboard and Zbrane-Reiner-Web -- release branch pushes :latest, devel pushes :devel. Requires a REGISTRY_TOKEN secret on this repo (Settings -> Actions -> Secrets), same as those two.
67 lines
1.7 KiB
YAML
67 lines
1.7 KiB
YAML
name: CI
|
|
|
|
# Spustí se při pushi do devel/release a jde i ručně spustit z GUI.
|
|
on:
|
|
push:
|
|
branches: [devel, release]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Instalace Poetry
|
|
run: pip install poetry==2.4.1
|
|
|
|
- name: Instalace závislostí (vč. dev skupiny)
|
|
run: poetry install --no-interaction
|
|
|
|
- name: Ruff
|
|
run: poetry run ruff check .
|
|
|
|
- name: Mypy
|
|
run: poetry run mypy src
|
|
|
|
- name: Testy
|
|
run: poetry run pytest -q
|
|
|
|
build-and-push:
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# Docker jméno musí být malými písmeny (Honza/Restreamer -> honza/restreamer)
|
|
- name: Název image
|
|
run: |
|
|
echo "IMAGE=gitea.doubynet.eu/$(echo '${{ github.repository }}' \
|
|
| tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
|
|
|
|
# release -> latest (produkce), devel -> devel (staging)
|
|
- name: Značka podle větve
|
|
run: |
|
|
if [ "${{ github.ref_name }}" = "release" ]; then
|
|
echo "MOVING_TAG=latest" >> "$GITHUB_ENV"
|
|
else
|
|
echo "MOVING_TAG=devel" >> "$GITHUB_ENV"
|
|
fi
|
|
|
|
- name: Přihlášení do Gitea registry
|
|
run: |
|
|
echo '${{ secrets.REGISTRY_TOKEN }}' \
|
|
| docker login gitea.doubynet.eu -u '${{ github.actor }}' --password-stdin
|
|
|
|
- name: Build image
|
|
run: docker build -t "$IMAGE:$MOVING_TAG" -t "$IMAGE:${{ github.sha }}" .
|
|
|
|
- name: Push image
|
|
run: |
|
|
docker push "$IMAGE:$MOVING_TAG"
|
|
docker push "$IMAGE:${{ github.sha }}"
|