66 - cron : " 15 3 * * *" # sadly there is no TZ support here
77 push :
88 branches :
9- - " * "
9+ - " main "
1010
1111permissions :
1212 contents : read
@@ -24,15 +24,26 @@ jobs:
2424 uses : actions/checkout@v5
2525 - name : Build container
2626 run : |
27- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
28- # ugly workaround for converting content of $GITHUB_REPOSITORY (= `MagicMirrorOrg/MagicMirror-3rd-Party-Modules`)
29- REPO="$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')"
30- # regular build
31- PARAMS="--output type=image,\"name=ghcr.io/${REPO}:${{ github.ref_name }}\",push=true"
32- else
33- # only build without pushing the image; still pull the full wiki dataset
34- PARAMS="--output type=image,push=false"
35- fi
27+ # ghcr requires lowercase repository names; normalize `MagicMirrorOrg/MagicMirror-3rd-Party-Modules`
28+ REPO="$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')"
29+ case "${{ github.event_name }}" in
30+ workflow_dispatch)
31+ # manual runs should publish a refreshed image tag
32+ PARAMS="--output type=image,\"name=ghcr.io/${REPO}:${{ github.ref_name }}\",push=true"
33+ ;;
34+ schedule)
35+ # nightly cron refresh publishes the image used by the website
36+ PARAMS="--output type=image,\"name=ghcr.io/${REPO}:${{ github.ref_name }}\",push=true"
37+ ;;
38+ push)
39+ # changes on main publish the branch tag
40+ PARAMS="--output type=image,\"name=ghcr.io/${REPO}:${{ github.ref_name }}\",push=true"
41+ ;;
42+ *)
43+ # fallback: build without pushing, but still run full build pipeline
44+ PARAMS="--output type=image,push=false"
45+ ;;
46+ esac
3647 # registry credentials
3748 export DOCKER_CONFIG="$(pwd)/container"
3849 echo "{\"auths\":{\"ghcr.io\":{\"auth\":\"$(echo -n ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} | base64 -w 0)\"}}}" > $DOCKER_CONFIG/config.json
0 commit comments