build: simplified check logic
This commit is contained in:
parent
19bd946047
commit
edcee500eb
2 changed files with 13 additions and 21 deletions
18
.github/workflows/auto-update.yml
vendored
18
.github/workflows/auto-update.yml
vendored
|
|
@ -2,18 +2,18 @@ name: update-bot
|
|||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 20 * * *'
|
||||
- cron: '00 23 * * *'
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: mogeko/qbittorrent
|
||||
IMAGE_NAME: ${{ github.repository_owner }}/qbittorrent
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
is_new: ${{ steps.check_ver.outputs.is_new }}
|
||||
version: ${{ steps.check_ver.outputs.version }}
|
||||
old_ver: ${{ steps.check_ver.outputs.old_ver }}
|
||||
new_ver: ${{ steps.check_ver.outputs.new_ver }}
|
||||
steps:
|
||||
- name: Check version
|
||||
id: check_ver
|
||||
|
|
@ -21,12 +21,8 @@ jobs:
|
|||
get_ver() (curl -s "$@" | grep -Po "(\d+\.)+\d+\-r\d+" | head -1)
|
||||
OLD_VER=$(get_ver ${GHCO_URL})
|
||||
NEW_VER=$(get_ver ${ALPINE_PKG_URL})
|
||||
if [ "$NEW_VER" != "$OLD_VER" ]; then
|
||||
echo "::set-output name=is_new::true"
|
||||
else
|
||||
echo "::set-output name=is_new::false"
|
||||
fi
|
||||
echo "::set-output name=version::${NEW_VER}"
|
||||
echo "::set-output name=old_ver::${OLD_VER}"
|
||||
echo "::set-output name=new_ver::${NEW_VER}"
|
||||
env:
|
||||
ALPINE_PKG_URL: https://pkgs.alpinelinux.org/package/edge/testing/x86_64/qbittorrent-nox
|
||||
GHCO_URL: https://github.com/mogeko/docker-qbittorrent/pkgs/container/qbittorrent
|
||||
|
|
@ -34,7 +30,7 @@ jobs:
|
|||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: check
|
||||
if: ${{ needs.check.outputs.is_new }}
|
||||
if: ${{ needs.check.outputs.old_ver != needs.check.outputs.new_ver }}
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
|
|
|
|||
16
.github/workflows/build.yml
vendored
16
.github/workflows/build.yml
vendored
|
|
@ -10,14 +10,14 @@ on:
|
|||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: mogeko/qbittorrent
|
||||
IMAGE_NAME: ${{ github.repository_owner }}/qbittorrent
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
is_new: ${{ steps.check_ver.outputs.is_new }}
|
||||
version: ${{ steps.check_ver.outputs.version }}
|
||||
old_ver: ${{ steps.check_ver.outputs.old_ver }}
|
||||
new_ver: ${{ steps.check_ver.outputs.new_ver }}
|
||||
steps:
|
||||
- name: Check version
|
||||
id: check_ver
|
||||
|
|
@ -25,12 +25,8 @@ jobs:
|
|||
get_ver() (curl -s "$@" | grep -Po "(\d+\.)+\d+\-r\d+" | head -1)
|
||||
OLD_VER=$(get_ver ${GHCO_URL})
|
||||
NEW_VER=$(get_ver ${ALPINE_PKG_URL})
|
||||
if [ "$NEW_VER" != "$OLD_VER" ]; then
|
||||
echo "::set-output name=is_new::true"
|
||||
else
|
||||
echo "::set-output name=is_new::false"
|
||||
fi
|
||||
echo "::set-output name=version::${NEW_VER}"
|
||||
echo "::set-output name=old_ver::${OLD_VER}"
|
||||
echo "::set-output name=new_ver::${NEW_VER}"
|
||||
env:
|
||||
ALPINE_PKG_URL: https://pkgs.alpinelinux.org/package/edge/testing/x86_64/qbittorrent-nox
|
||||
GHCO_URL: https://github.com/mogeko/docker-qbittorrent/pkgs/container/qbittorrent
|
||||
|
|
@ -38,7 +34,7 @@ jobs:
|
|||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: check
|
||||
if: ${{ needs.check.outputs.is_new }}
|
||||
if: ${{ needs.check.outputs.old_ver != needs.check.outputs.new_ver }}
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue