build-radio change
This commit is contained in:
@@ -7,6 +7,8 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 2
|
||||||
|
|
||||||
- name: Login do rejestru
|
- name: Login do rejestru
|
||||||
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.czernobog.pl -u gitea --password-stdin
|
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.czernobog.pl -u gitea --password-stdin
|
||||||
@@ -30,15 +32,39 @@ jobs:
|
|||||||
docker push gitea.czernobog.pl/gitea/conjurer-share:$TAG
|
docker push gitea.czernobog.pl/gitea/conjurer-share:$TAG
|
||||||
|
|
||||||
# RADIO: budowane TYLKO gdy zmieniło się coś istotnego (oszczędza ~15 min na push)
|
# RADIO: budowane TYLKO gdy zmieniło się coś istotnego (oszczędza ~15 min na push)
|
||||||
|
|
||||||
|
|
||||||
- name: Czy radio wymaga rebuildu?
|
- name: Czy radio wymaga rebuildu?
|
||||||
id: radio_changed
|
id: radio_changed
|
||||||
|
env:
|
||||||
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
if git diff --name-only HEAD~1 HEAD | grep -qE "docker/Dockerfile.radio|docker/entrypoint.radio.sh|docker/icecast.xml.tpl|docker/pulse-system.pa|conjurer_musician/radio_conjurer.liq|conjurer_betoniarka/"; then
|
NEED=no
|
||||||
echo "build=yes" >> $GITHUB_OUTPUT
|
|
||||||
else
|
# Warunek 1: zmiany w plikach radia
|
||||||
echo "build=no" >> $GITHUB_OUTPUT
|
if git rev-parse HEAD~1 >/dev/null 2>&1; then BASE=HEAD~1; else BASE=$(git hash-object -t tree /dev/null); fi
|
||||||
echo "radio bez zmian — pomijam ciężki build"
|
if git diff --name-only "$BASE" HEAD | grep -qE "docker/Dockerfile.radio|docker/entrypoint.radio.sh|docker/icecast.xml.tpl|docker/pulse-system.pa|conjurer_musician/radio_conjurer.liq|conjurer_betoniarka/"; then
|
||||||
|
NEED=yes
|
||||||
|
echo "radio: wykryto zmiany w plikach → build"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Warunek 2: obrazu nie ma w rejestrze (inicjalizacja)
|
||||||
|
if [ "$NEED" = "no" ]; then
|
||||||
|
TAGS=$(curl -s -u "gitea:${REGISTRY_TOKEN}" \
|
||||||
|
"https://gitea.czernobog.pl/v2/gitea/conjurer-radio/tags/list" 2>/dev/null || true)
|
||||||
|
# brak tagów w ogóle = obraz nie istnieje → zbuduj
|
||||||
|
if ! echo "$TAGS" | grep -q '"tags"[[:space:]]*:[[:space:]]*\['; then
|
||||||
|
NEED=yes
|
||||||
|
echo "radio: brak obrazu w rejestrze → build inicjalizujący"
|
||||||
|
elif echo "$TAGS" | grep -qE '"tags"[[:space:]]*:[[:space:]]*\[[[:space:]]*\]|"tags"[[:space:]]*:[[:space:]]*null'; then
|
||||||
|
NEED=yes
|
||||||
|
echo "radio: obraz istnieje ale bez tagów → build"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "build=$NEED" >> $GITHUB_OUTPUT
|
||||||
|
[ "$NEED" = "no" ] && echo "radio bez zmian i obraz istnieje — pomijam ciężki build" || true
|
||||||
|
|
||||||
- name: Build radio
|
- name: Build radio
|
||||||
if: steps.radio_changed.outputs.build == 'yes'
|
if: steps.radio_changed.outputs.build == 'yes'
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user