77 push :
88 branches :
99 - " main"
10+ - " develop"
1011
1112permissions :
1213 contents : read
@@ -16,36 +17,30 @@ jobs:
1617 build :
1718 runs-on : ubuntu-latest
1819 timeout-minutes : 60
20+ container :
21+ image : moby/buildkit:latest
22+ options : --privileged
1923 steps :
2024 - name : Checkout code
2125 uses : actions/checkout@v5
22-
23- - name : Derive image coordinates
24- id : meta
26+ - name : Build container
2527 run : |
26- set -euo pipefail
27- repo="${GITHUB_REPOSITORY,,}"
28- ref="${GITHUB_REF_NAME}"
29- sanitized_ref=$(echo "${ref}" | tr '[:upper:]' '[:lower:]' | sed 's#[^a-z0-9_.-]#-#g')
30- echo "image=ghcr.io/${repo}:${sanitized_ref}" >> "$GITHUB_OUTPUT"
31-
32- - name : Set up Docker Buildx
33- uses : docker/setup-buildx-action@v3
34-
35- - name : Log in to GitHub Container Registry
36- uses : docker/login-action@v3
37- with :
38- registry : ghcr.io
39- username : ${{ github.actor }}
40- password : ${{ secrets.GITHUB_TOKEN }}
41-
42- - name : Build and push image
43- uses : docker/build-push-action@v6
44- with :
45- context : .
46- file : container/Dockerfile
47- push : true
48- platforms : linux/amd64
49- build-args : |
50- GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
51- tags : ${{ steps.meta.outputs.image }}
28+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
29+ # ugly workaround for converting content of $GITHUB_REPOSITORY (= `MagicMirrorOrg/MagicMirror-3rd-Party-Modules`)
30+ REPO="$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')"
31+ # regular build
32+ PARAMS="--output type=image,\"name=ghcr.io/${REPO}:${{ github.ref_name }}\",push=true"
33+ else
34+ # only build with small wiki list and no image push
35+ PARAMS="--output type=image,push=false --opt build-arg:WIKI_FILE=website/test/3rd-Party-Modules.md"
36+ fi
37+ # registry credentials
38+ export DOCKER_CONFIG="$(pwd)/container"
39+ echo "{\"auths\":{\"ghcr.io\":{\"auth\":\"$(echo -n ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} | base64 -w 0)\"}}}" > $DOCKER_CONFIG/config.json
40+ # build
41+ buildctl-daemonless.sh build \
42+ --progress plain \
43+ --frontend=dockerfile.v0 \
44+ --local context=. \
45+ --local dockerfile=container \
46+ $PARAMS
0 commit comments