Skip to content

Added uid/gid wisdom #91

Added uid/gid wisdom

Added uid/gid wisdom #91

Workflow file for this run

name: Zwift script files updater
on:
push:
branches:
- master
jobs:
zwift_push:
runs-on: ubuntu-22.04
timeout-minutes: 60
concurrency: zwift
steps:
- uses: netbrain/[email protected]
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v4
- name: Get latest zwift container and diff script files
run: |
set -x
docker pull netbrain/zwift:latest
docker create --name zwift netbrain/zwift:latest
declare -A files_map
files_map["/bin/entrypoint"]="entrypoint.sh"
files_map["/bin/zwift-auth"]="zwift-auth.sh"
files_map["/bin/update_zwift.sh"]="update_zwift.sh"
files_map["/bin/run_zwift.sh"]="run_zwift.sh"
has_changes=false
for container_path in "${!files_map[@]}"; do
local_file="${files_map[${container_path}]}"
docker cp "zwift:${container_path}" "/tmp/${local_file}"
diff_exit_code=$(diff "${local_file}" "/tmp/${local_file}" > /dev/null; echo $?)
if [[ $diff_exit_code -eq 1 ]]; then
has_changes=true
docker cp "${local_file}" "zwift:${container_path}"
fi
done
if [ "$has_changes" = true ]; then
export BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
docker commit --change="LABEL org.opencontainers.image.created=$BUILD_DATE" \
-m "Updated script files from git ($GITHUB_SHA)" \
zwift \
netbrain/zwift:latest
docker push "netbrain/zwift:latest"
fi
docker rm zwift