added ytdlp/youdis version tags, check youdis:latest before build
Some checks failed
build + push containers to gitea (every) and docker (daily) / docker (push) Has been cancelled
Some checks failed
build + push containers to gitea (every) and docker (daily) / docker (push) Has been cancelled
This commit is contained in:
@@ -2,69 +2,94 @@ name: build + push containers to gitea (every) and docker (daily)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: ["master"]
|
||||
schedule:
|
||||
- cron: '0 0 * * 0' # weekly check
|
||||
- cron: '0 0 * * 0' # weekly
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
dockerhub:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Get current version
|
||||
id: current
|
||||
- name: Get youdis version
|
||||
id: youdis
|
||||
run: |
|
||||
CURRENT=$(cat version.txt || echo "none")
|
||||
echo "version=$CURRENT" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: check latest yt-dlp release
|
||||
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
|
||||
YOUDIS_VER=$(cat youdis-version.txt)
|
||||
if [ -z "$YOUDIS_VER" ]; then
|
||||
echo "youdis version empty" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "yt-dlp version=$LATEST" >> $GITHUB_OUTPUT
|
||||
echo "youdis-version=$YOUDIS_VER" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Update version file if changed
|
||||
run: echo ${{ steps.latest.outputs.version }} > version.txt
|
||||
if: ${{ steps.current.outputs.version != steps.latest.outputs.version }}
|
||||
- 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
|
||||
|
||||
- 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
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push to Dockerhub
|
||||
if: ${{ steps.check_build.outputs.should_build == 'true' }}
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
push: true
|
||||
tags: |
|
||||
eulaly/youdis:latest
|
||||
eulaly/youdis:${{ steps.latest.outputs.version }}
|
||||
if: ${{ steps.current.outputs.version != steps.latest.outputs.version }}
|
||||
eulaly/youdis:dev-${{ github.sha }}
|
||||
eulaly/youdis:ytldlp-${{ steps.ytdlp.outputs.ytdlp-version }}
|
||||
labels: |
|
||||
YOUDIS_VERSION=${{ steps.youdis.outputs.youdis-version }}
|
||||
YTDLP_VERSION=${{ steps.ytdlp.outputs.ytdlp-version }}
|
||||
|
||||
gitea:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Gitea (local)
|
||||
uses: docker/login-action@v2
|
||||
- name: Login to Gitea
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.hgsky.me
|
||||
username: ${{ secrets.GITEA_USERNAME }}
|
||||
password: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
- name: Build and push to Gitea (all pushes)
|
||||
- name: Build and push to Gitea
|
||||
if: ${{ steps.check_build.outputs.should_build == 'true' }}
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
push: true
|
||||
tags: |
|
||||
git.hgsky.me/eulaly/youdis:latest
|
||||
git.hgsky.me/eulaly/youdis:dev-${{ github.sha }}
|
||||
|
||||
git.hgsky.me/eulaly/youdis:ytldlp-${{ steps.ytdlp.outputs.ytdlp-version }}
|
||||
labels: |
|
||||
YOUDIS_VERSION=${{ steps.youdis.outputs.youdis-version }}
|
||||
YTDLP_VERSION=${{ steps.ytdlp.outputs.ytdlp-version }}
|
||||
|
||||
1
youdis-version.txt
Normal file
1
youdis-version.txt
Normal file
@@ -0,0 +1 @@
|
||||
20250823-32ed9bc
|
||||
Reference in New Issue
Block a user