Skip to content

Commit

Permalink
Add new version checker (#180)
Browse files Browse the repository at this point in the history
* Add logic to allow user check new version

* update action
  • Loading branch information
wahyd4 authored Oct 13, 2021
1 parent 42f1317 commit 56190ae
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 3 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,24 @@ jobs:
if: contains(github.ref, '/heads/master') || contains(github.ref, '/tags/v')
run: |
docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
- name: Update tag
-
name: Update APP VERSION
if: contains(github.ref, '/tags/v')
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo $VERSION > APP_VERSION
-
name: Commit changes
if: contains(github.ref, '/tags/v')
uses: EndBug/add-and-commit@v7
with:
author_name: junv-repo-bot
author_email: [email protected]
message: 'Update version'
add: 'APP_VERSION'
push: true
-
name: Update tag
if: contains(github.ref, '/tags/v')
env:
API_KEY: ${{ secrets.BadgeAPIKey }}
Expand Down
1 change: 1 addition & 0 deletions APP_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.8.2.2
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ENV XDG_DATA_HOME=/app/.caddy/data
ENV XDG_CONFIG_HOME=/app/.caddy/config
ENV RCLONE_CONFIG_BASE64=""

ADD install.sh aria2c.sh caddy.sh Procfile init.sh start.sh rclone.sh /app/
ADD install.sh aria2c.sh caddy.sh Procfile init.sh start.sh rclone.sh new-version-checker.sh APP_VERSION /app/
ADD conf /app/conf
ADD Caddyfile SecureCaddyfile HerokuCaddyfile /usr/local/caddy/

Expand Down
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ caddy: /app/caddy.sh
filebrowser: /app/filebrowser -p 8080 -d /app/filebrowser.db -r /data -b /files
aria2c: /app/aria2c.sh
rclone: /app/rclone.sh
newer_version_checker: /app/new-version-checker.sh
24 changes: 24 additions & 0 deletions new-version-checker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#! /bin/bash -u
sleep 5

set -e
APP_VERSION=$(cat APP_VERSION)
set +e
while true; do
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Checking for new version against ${APP_VERSION} ..."
newer_version=$(curl -s https://badges.toozhao.com/val/aria2-ui-docker?version=${APP_VERSION})
if [ -z ${newer_version} ]; then
echo "[WARN] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Failed to check new version."
sleep 86400
continue
fi

if [ ${newer_version} != ${APP_VERSION} ]; then
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Found newer Docker image version wahyd4/aria2-ui:${newer_version}, please consider to upgrade by using docker pull command to have better user experience."
# check new version daily
sleep 86400
continue
fi
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Good job, you are using the latest version docker image"
sleep 86400
done

0 comments on commit 56190ae

Please sign in to comment.