fixed youdis shortsha syntax
All checks were successful
weekly, if new yt-dlp, build + push container to docker/gitea / build (push) Successful in 2m29s

This commit is contained in:
2025-08-24 15:35:21 -04:00
parent 690f97ed82
commit 81619074d7
3 changed files with 57 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
name: build + push containers to gitea (every) and docker (daily) name: weekly, if new yt-dlp, build + push container to docker/gitea
on: on:
push: push:
@@ -22,6 +22,7 @@ jobs:
exit 1 exit 1
fi fi
echo "youdis-version=$YOUDIS_VER" >> $GITHUB_OUTPUT echo "youdis-version=$YOUDIS_VER" >> $GITHUB_OUTPUT
echo "shortsha=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
- name: Get latest yt-dlp version - name: Get latest yt-dlp version
id: ytdlp id: ytdlp
@@ -68,7 +69,7 @@ jobs:
push: true push: true
tags: | tags: |
eulaly/youdis:latest eulaly/youdis:latest
eulaly/youdis:ytldlp-${{ steps.ytdlp.outputs.ytdlp-version }}.youdis-${{ github.sha::7 }} eulaly/youdis:ytldlp-${{ steps.ytdlp.outputs.ytdlp-version }}.youdis-${{ steps.youdis.outputs.shortsha }}
labels: | labels: |
YOUDIS_VERSION=${{ steps.youdis.outputs.youdis-version }} YOUDIS_VERSION=${{ steps.youdis.outputs.youdis-version }}
YTDLP_VERSION=${{ steps.ytdlp.outputs.ytdlp-version }} YTDLP_VERSION=${{ steps.ytdlp.outputs.ytdlp-version }}
@@ -87,7 +88,7 @@ jobs:
push: true push: true
tags: | tags: |
git.hgsky.me/ben/youdis/youdis:latest git.hgsky.me/ben/youdis/youdis:latest
git.hgsky.me/ben/youdis/youdis:ytldlp-${{ steps.ytdlp.outputs.ytdlp-version }}.youdis-${{ github.sha::7 }} git.hgsky.me/ben/youdis/youdis:ytldlp-${{ steps.ytdlp.outputs.ytdlp-version }}.youdis-${{ steps.youdis.outputs.shortsha }}
labels: | labels: |
YOUDIS_VERSION=${{ steps.youdis.outputs.youdis-version }} YOUDIS_VERSION=${{ steps.youdis.outputs.youdis-version }}
YTDLP_VERSION=${{ steps.ytdlp.outputs.ytdlp-version }} YTDLP_VERSION=${{ steps.ytdlp.outputs.ytdlp-version }}

View File

@@ -1,7 +1,11 @@
name: Check yt-dlp and rebuild if new # github disables scheduled workflows if repo is stagnant 60d
name: weekly, if new yt-dlp version, build + push containers to docker
on: on:
push:
branches: ["master"]
schedule: schedule:
- cron: '0 0 * * 0' - cron: '0 0 * * 0' # weekly
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@@ -10,35 +14,62 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Get current version - name: Get youdis version
id: current id: youdis
run: | run: |
CURRENT=$(cat version.txt || echo "none") YOUDIS_VER=$(cat youdis-version.txt)
echo "version=$CURRENT" >> $GITHUB_OUTPUT if [ -z "$YOUDIS_VER" ]; then
echo "youdis version empty" >&2
- name: Check latest version
id: latest
run: |
LATEST=$(curl -s https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest | jq -r .tag_name || echo "error")
if [ "$LATEST" == "error" ]; then
echo "failed to fetch latest version" >&2
exit 1 exit 1
fi fi
echo "version=$LATEST" >> $GITHUB_OUTPUT echo "youdis-version=$YOUDIS_VER" >> $GITHUB_OUTPUT
- name: Update version file if changed - name: Get latest yt-dlp version
run: echo ${{ steps.latest.outputs.version }} > version.txt id: ytdlp
if: ${{ steps.current.outputs.version != steps.latest.outputs.version }} 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
- name: Decide if build needed
id: check_build
run: |
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
- name: Login to Dockerhub - name: Login to Dockerhub
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push docker image - name: Build and push to Dockerhub
if: ${{ steps.check_build.outputs.should_build == 'true' }}
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
push: true push: true
tags: eulaly/youdis:latest,eulaly/youdis:${{ steps.latest.outputs.version }} tags: |
if: ${{ steps.current.outputs.version != steps.latest.outputs.version }} eulaly/youdis:latest
eulaly/youdis:ytldlp-${{ steps.ytdlp.outputs.ytdlp-version }}.youdis-${{ github.sha::7 }}
labels: |
YOUDIS_VERSION=${{ steps.youdis.outputs.youdis-version }}
YTDLP_VERSION=${{ steps.ytdlp.outputs.ytdlp-version }}

View File

@@ -1 +1 @@
20250824-b772383 20250824-690f97e