Skip to content

Zwift updater

Zwift updater #23885

name: Zwift updater
on:
workflow_dispatch:
schedule:
- cron: "0 * * * *"
jobs:
zwift_updater:
runs-on: ubuntu-22.04
timeout-minutes: 360
concurrency: zwift
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install dependencies
run: sudo apt-get install -y x11-xserver-utils x11-apps
- uses: netbrain/[email protected]
- name: Check for zwift update
run: |
set -x
export VERSION=$(curl -s http://cdn.zwift.com/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml | grep -oP 'sversion="\K.*?(?=")' | cut -f 1 -d ' ')
export IMAGE_VERSION=$(curl -s https://hub.docker.com/v2/repositories/netbrain/zwift/tags/ | jq -r '.results[1].name')
export BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo "Latest zwift version is $VERSION"
echo "Latest zwift container image version is $IMAGE_VERSION"
if [[ "$IMAGE_VERSION" = "$VERSION" ]]
then
exit 0
fi
echo "Starting update..."
Xvfb :99 -ac -screen 0 "800x600x24" -nolisten tcp &
sleep 3
export DISPLAY=:99
xhost +
docker run --name zwift \
--privileged \
-e DISPLAY=$DISPLAY \
--device /dev/dri \
-v /tmp:/tmp \
netbrain/zwift:latest update
docker commit --change="LABEL org.opencontainers.image.created=$BUILD_DATE" \
--change="LABEL org.opencontainers.image.version=$VERSION" \
--change='CMD [""]' \
-m "updated to version $VERSION" \
zwift \
netbrain/zwift:$VERSION
docker tag netbrain/zwift:$VERSION netbrain/zwift:latest
docker push netbrain/zwift:$VERSION
docker push netbrain/zwift:latest