update ytdlp on container start; cleanup gitea workflow
Some checks failed
push new builds to gitea, dockerhub / build (push) Failing after 38s
Some checks failed
push new builds to gitea, dockerhub / build (push) Failing after 38s
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
name: weekly, if new yt-dlp, build + push container to docker/gitea
|
||||
name: push new builds to gitea, dockerhub
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["master"]
|
||||
schedule:
|
||||
- cron: '0 0 * * 0' # weekly
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@@ -22,28 +20,7 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
echo "youdis-version=$YOUDIS_VER" >> $GITHUB_OUTPUT
|
||||
echo "shortsha=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Get latest yt-dlp version
|
||||
id: ytdlp
|
||||
run: |
|
||||
LATEST=$(curl -s https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest | jq -r .tag_name)
|
||||
if [ -z "$LATEST" ]; then
|
||||
echo "failed to fetch yt-dlp release" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "ytdlp-version=$LATEST" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Get current yt-dlp version from latest container
|
||||
id: current_ytdlp
|
||||
run: |
|
||||
docker pull eulaly/youdis:latest || true
|
||||
if docker image inspect eulaly/youdis:latest >/dev/null 2>&1; then
|
||||
CURR=$(docker inspect --format='{{ index .Config.Labels "YTDLP_VERSION" }}' eulaly/youdis:latest)
|
||||
else
|
||||
CURR="none"
|
||||
fi
|
||||
echo "current-ytdlp=$CURR" >> $GITHUB_OUTPUT
|
||||
echo "shortsha=${GITHUB_SHA::5}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Decide if build needed
|
||||
id: check_build
|
||||
@@ -51,8 +28,6 @@ jobs:
|
||||
SHOULD_BUILD=false
|
||||
if [ "${{ steps.youdis.outputs.youdis-version }}" != "$(docker inspect --format='{{ index .Config.Labels "YOUDIS_VERSION" }}' eulaly/youdis:latest || echo none)" ]; then
|
||||
SHOULD_BUILD=true
|
||||
elif [ "${{ steps.ytdlp.outputs.ytdlp-version }}" != "${{ steps.current_ytdlp.outputs.current-ytdlp }}" ]; then
|
||||
SHOULD_BUILD=true
|
||||
fi
|
||||
echo "should_build=$SHOULD_BUILD" >> $GITHUB_OUTPUT
|
||||
|
||||
@@ -69,17 +44,15 @@ jobs:
|
||||
push: true
|
||||
tags: |
|
||||
eulaly/youdis:latest
|
||||
eulaly/youdis:ytldlp-${{ steps.ytdlp.outputs.ytdlp-version }}.youdis-${{ steps.youdis.outputs.shortsha }}
|
||||
eulaly/youdis:${{ steps.youdis.outputs.shortsha }}
|
||||
labels: |
|
||||
YOUDIS_VERSION=${{ steps.youdis.outputs.youdis-version }}
|
||||
YTDLP_VERSION=${{ steps.ytdlp.outputs.ytdlp-version }}
|
||||
|
||||
- name: Login to Gitea
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.hgsky.me
|
||||
username: ${{ secrets.USERNAME }}
|
||||
#username: ${{ vars.CI_ACTOR }}
|
||||
password: ${{ secrets.YOUDIS_PASSWORD }}
|
||||
|
||||
- name: Build and push to Gitea
|
||||
@@ -89,10 +62,9 @@ jobs:
|
||||
push: true
|
||||
tags: |
|
||||
git.hgsky.me/ben/youdis:latest
|
||||
git.hgsky.me/ben/youdis:ytldlp-${{ steps.ytdlp.outputs.ytdlp-version }}.youdis-${{ steps.youdis.outputs.shortsha }}
|
||||
git.hgsky.me/ben/youdis:${{ steps.youdis.outputs.shortsha }}
|
||||
labels: |
|
||||
YOUDIS_VERSION=${{ steps.youdis.outputs.youdis-version }}
|
||||
YTDLP_VERSION=${{ steps.ytdlp.outputs.ytdlp-version }}
|
||||
|
||||
- name: link container in gitea
|
||||
run: |
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
#copy yt-dlp.conf if missing
|
||||
mkdir -p /config
|
||||
if [ ! -f /config/yt-dlp.conf ]; then
|
||||
cp /app/default-yt-dlp.conf /config/yt-dlp.conf
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
16
dockerfile
16
dockerfile
@@ -4,11 +4,13 @@ WORKDIR /app
|
||||
RUN apk update && \
|
||||
apk add --no-cache build-base ffmpeg && \
|
||||
rm -rf /var/cache/apk/*
|
||||
COPY requirements.txt requirements.txt
|
||||
COPY requirements.txt .
|
||||
RUN python3 -m pip install --no-cache-dir -r requirements.txt
|
||||
COPY youdis.py youdis.py
|
||||
COPY default-yt-dlp.conf /app/default-yt-dlp.conf
|
||||
COPY create-ytdlp-config.sh /app/create-ytdlp-config.sh
|
||||
RUN chmod 755 /app/create-ytdlp-config.sh
|
||||
ENTRYPOINT ["/app/create-ytdlp-config.sh"]
|
||||
CMD ["python3", "youdis.py"]
|
||||
|
||||
COPY youdis.py, default-yt-dlp.conf, update-ytdlp.sh run-youdis.sh /app/
|
||||
RUN chmod +x /app/update-ytdlp.sh /app/run-youdis.sh
|
||||
|
||||
COPY weekly-restart /etc/cron.d/
|
||||
RUN chmod 0644 /etc/cron.d/weekly-restart
|
||||
|
||||
ENTRYPOINT ["/app/run-youdis.sh"]
|
||||
|
||||
21
run-youdis.sh
Normal file
21
run-youdis.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
#start crond in bg
|
||||
crond -l 2
|
||||
|
||||
echo "checking for /config/yt-dlp.conf"
|
||||
#copy yt-dlp.conf if missing
|
||||
mkdir -p /config
|
||||
if [ ! -f /config/yt-dlp.conf ]; then
|
||||
echo "yt-dlp.conf not found, setting default"
|
||||
cp /app/default-yt-dlp.conf /config/yt-dlp.conf
|
||||
echo "created yt-dlp.conf"
|
||||
fi
|
||||
|
||||
python3 -m pip install --no-cache-dir --upgrade --pre "yt-dlp[default]"
|
||||
VERSION=$(python3 -m pip show yt-dlp 2>/dev/null | awk '/Version:/ {print $2}')
|
||||
echo "updated yt-dlp to $VERSION"
|
||||
|
||||
echo "starting youdis"
|
||||
exec python3 /app/youdis.py
|
||||
12
update-ytdlp.sh
Normal file
12
update-ytdlp.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
echo "updating yt-dlp"
|
||||
echo "killing youdis"
|
||||
pkill -f youdis.py || true
|
||||
python3 -m pip install --no-cache-dir --upgrade --pre "yt-dlp[default]"
|
||||
VERSION=$(python3 -m pip show yt-dlp 2>/dev/null | awk '/Version:/ {print $2}')
|
||||
|
||||
echo "updated yt-dlp to $VERSION"
|
||||
echo "restarting youdis"
|
||||
python3 /app/youdis.py &
|
||||
1
weekly-restart
Normal file
1
weekly-restart
Normal file
@@ -0,0 +1 @@
|
||||
0 3 * * 0 root /app/update-ytdlp.sh
|
||||
@@ -1 +1 @@
|
||||
20250824-f173c64
|
||||
20250829-d539915
|
||||
|
||||
Reference in New Issue
Block a user