Some checks failed
Daily Docker Build / Update-Check & Build (push) Failing after 1m31s
103 lines
4.5 KiB
YAML
103 lines
4.5 KiB
YAML
# VDO.Ninja Docker - Daily Build
|
|
# Prüft täglich um 20:00 Uhr (MESZ) auf Updates und baut ein neues Docker Image
|
|
# Quelle: https://github.com/steveseguin/vdo.ninja
|
|
|
|
name: Daily Docker Build
|
|
|
|
on:
|
|
schedule:
|
|
# 18:00 UTC = 20:00 MESZ (Sommerzeit) / 19:00 MEZ (Winterzeit)
|
|
- cron: '0 18 * * *'
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
IMAGE_NAME: vdo-ninja
|
|
UPSTREAM_REPO: https://github.com/steveseguin/vdo.ninja
|
|
|
|
jobs:
|
|
check-and-build:
|
|
name: Update-Check & Build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Auf VDO.Ninja Updates prüfen
|
|
id: check
|
|
run: |
|
|
# Neuesten Versions-Tag vom Upstream ermitteln (z.B. v29.0)
|
|
UPSTREAM_TAG=$(git ls-remote --tags --sort=-v:refname ${{ env.UPSTREAM_REPO }} 'v*' | head -n1 | sed 's/.*refs\/tags\///' | sed 's/\^{}//')
|
|
if [ -z "$UPSTREAM_TAG" ]; then
|
|
echo "::error::Kein Versions-Tag im Upstream-Repo gefunden."
|
|
exit 1
|
|
fi
|
|
echo "upstream_tag=${UPSTREAM_TAG}" >> "$GITHUB_OUTPUT"
|
|
|
|
# Registry-URL bereinigen (Protokoll entfernen)
|
|
REGISTRY="${{ vars.REGISTRY_URL }}"
|
|
REGISTRY="${REGISTRY#https://}"
|
|
REGISTRY="${REGISTRY#http://}"
|
|
echo "registry=${REGISTRY}" >> "$GITHUB_OUTPUT"
|
|
|
|
# Prüfen ob ein Image mit diesem Versions-Tag bereits existiert
|
|
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
|
|
-u "${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_TOKEN }}" \
|
|
"${{ vars.REGISTRY_URL }}/v2/${{ secrets.REGISTRY_USER }}/${{ env.IMAGE_NAME }}/manifests/${UPSTREAM_TAG}" \
|
|
-H "Accept: application/vnd.docker.distribution.manifest.v2+json" 2>/dev/null || echo "000")
|
|
|
|
if [ "$HTTP_CODE" = "200" ] && [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
|
|
echo "Image mit Version ${UPSTREAM_TAG} existiert bereits. Build wird übersprungen."
|
|
echo "should_build=false" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "Neue Version ${UPSTREAM_TAG} erkannt. Image wird gebaut."
|
|
echo "should_build=true" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: VDO.Ninja Quellcode klonen
|
|
if: steps.check.outputs.should_build == 'true'
|
|
run: |
|
|
git clone --depth 1 ${{ env.UPSTREAM_REPO }} vdo-ninja-source
|
|
echo "VDO.Ninja Commit: $(cd vdo-ninja-source && git rev-parse --short HEAD)"
|
|
|
|
- name: Bei Gitea Registry einloggen
|
|
if: steps.check.outputs.should_build == 'true'
|
|
run: |
|
|
echo "${{ secrets.REGISTRY_TOKEN }}" | \
|
|
docker login ${{ steps.check.outputs.registry }} \
|
|
--username "${{ secrets.REGISTRY_USER }}" \
|
|
--password-stdin
|
|
|
|
- name: Docker Image bauen
|
|
if: steps.check.outputs.should_build == 'true'
|
|
run: |
|
|
docker build \
|
|
-t ${{ steps.check.outputs.registry }}/${{ secrets.REGISTRY_USER }}/${{ env.IMAGE_NAME }}:latest \
|
|
-t ${{ steps.check.outputs.registry }}/${{ secrets.REGISTRY_USER }}/${{ env.IMAGE_NAME }}:${{ steps.check.outputs.upstream_tag }} \
|
|
.
|
|
|
|
- name: Docker Image pushen
|
|
if: steps.check.outputs.should_build == 'true'
|
|
run: |
|
|
docker push ${{ steps.check.outputs.registry }}/${{ secrets.REGISTRY_USER }}/${{ env.IMAGE_NAME }}:latest
|
|
docker push ${{ steps.check.outputs.registry }}/${{ secrets.REGISTRY_USER }}/${{ env.IMAGE_NAME }}:${{ steps.check.outputs.upstream_tag }}
|
|
|
|
- name: Build-Zusammenfassung
|
|
if: always()
|
|
run: |
|
|
if [ "${{ steps.check.outputs.should_build }}" = "true" ]; then
|
|
echo "### Docker Build Zusammenfassung" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Eigenschaft | Wert |" >> $GITHUB_STEP_SUMMARY
|
|
echo "|---|---|" >> $GITHUB_STEP_SUMMARY
|
|
echo "| **Image** | \`${{ env.IMAGE_NAME }}\` |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| **VDO.Ninja Version** | \`${{ steps.check.outputs.upstream_tag }}\` |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| **Tags** | \`latest\`, \`${{ steps.check.outputs.upstream_tag }}\` |" >> $GITHUB_STEP_SUMMARY
|
|
else
|
|
echo "### Kein Update erforderlich" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "VDO.Ninja Version \`${{ steps.check.outputs.upstream_tag }}\` ist bereits als Image vorhanden." >> $GITHUB_STEP_SUMMARY
|
|
fi
|