Skip to content

ZWIFT_FG and interactive shell (#343) #188

ZWIFT_FG and interactive shell (#343)

ZWIFT_FG and interactive shell (#343) #188

Workflow file for this run

---
name: Zwift script files updater
'on':
push:
branches:
- master
concurrency:
group: zwift-container-image
jobs:
zwift_push:
if: github.repository == 'netbrain/zwift'
runs-on: ubuntu-22.04
timeout-minutes: 60
steps:
- uses: netbrain/free-disk-space-action@v0.0.1
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v6
- name: Get latest zwift container and diff script files
run: |
docker pull netbrain/zwift:latest
docker create --name zwift netbrain/zwift:latest
declare -A files_map
files_map["/bin/entrypoint"]="src/entrypoint.sh"
files_map["/bin/zwift-auth"]="src/zwift-auth.sh"
files_map["/bin/update_zwift.sh"]="src/update_zwift.sh"
files_map["/bin/run_zwift.sh"]="src/run_zwift.sh"
has_changes=0
for container_path in "${!files_map[@]}"; do
local_file="${files_map[${container_path}]}"
mkdir -p "$(dirname "/tmp/${local_file}")"
docker cp "zwift:${container_path}" "/tmp/${local_file}"
diff "${local_file}" "/tmp/${local_file}" > /dev/null || {
if [[ ${?} -eq 1 ]]; then
has_changes=1
docker cp "${local_file}" "zwift:${container_path}"
else
echo "::error::Failed to diff '${local_file}'"
exit 1
fi
}
done
if [[ ${has_changes} -eq 1 ]]; then
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