1- name : Bake and Push
1+ name : Reusable | Bake and Push
22
33permissions :
44 contents : read
55 actions : read
66
7- # Reusable workflow for building and pushing a bake target.
7+ # Reusable workflow for building and optionally pushing a bake target.
88# Replaces build-docker-image.yml for apps migrated to docker-bake.hcl.
99#
1010# Callers pass app-specific build args via the `set` input using GitHub Variables
2525 required : true
2626 type : string
2727 description : >
28- JSON string. Target OS ( e.g. ubuntu-24.04-arm or
29- [' ubuntu-24.04-arm', 'ubuntu-24.04']) of the image
28+ JSON string passed to runs-on via fromJSON, e.g.
29+ [" ubuntu-24.04-arm"].
3030 tag :
3131 required : true
3232 type : string
33- description : " Image tag to push (e.g. git SHA or semver)"
33+ description : " Image tag to build or push (e.g. git SHA or semver)"
34+ push :
35+ required : false
36+ type : boolean
37+ default : true
38+ description : " Whether to push the built image to the registry"
3439 base_tag :
3540 required : false
3641 type : string
3742 default : " "
3843 description : >
3944 Pre-built base image tag (BASE_TAG). When set, pulls ui-builder-base
4045 and ui-runner-base from the registry instead of building them inline.
41- Use this in CI to avoid rebuilding base images on every app push.
42- Omit (or leave empty) to build base images inline — useful when
43- testing base image changes locally via act or in build-base-images.yml.
46+ Required for CI app builds so they reuse published base images rather
47+ than rebuilding base images inline.
4448 set :
4549 required : false
4650 type : string
5660 DATABASE_URL :
5761 required : false
5862 DOCKER_HUB_USERNAME :
59- required : true
63+ required : false
6064 DOCKER_HUB_ACCESS_TOKEN :
61- required : true
65+ required : false
6266 PAYLOAD_SECRET :
6367 required : false
6468 SENTRY_AUTH_TOKEN :
@@ -82,14 +86,21 @@ jobs:
8286 id : meta
8387 run : echo "date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_OUTPUT"
8488
89+ - name : Validate base image tag
90+ if : ${{ inputs.base_tag == '' }}
91+ run : |
92+ echo "::error::base_tag is required for CI app builds. Build and publish base images, then set vars.UI_BASE_TAG."
93+ exit 1
94+
8595 - uses : docker/setup-buildx-action@v4
8696
8797 - uses : docker/login-action@v4
98+ if : ${{ inputs.push }}
8899 with :
89100 username : ${{ secrets.DOCKER_HUB_USERNAME }}
90101 password : ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
91102
92- - name : Build and push
103+ - name : Build with Docker bake
93104 uses : docker/bake-action@v7
94105 env :
95106 TAG : ${{ inputs.tag }}
@@ -104,7 +115,7 @@ jobs:
104115 with :
105116 files : docker-bake.hcl
106117 targets : ${{ inputs.target }}
107- push : true
118+ push : ${{ inputs.push }}
108119 set : |
109120 *.cache-from=type=gha,scope=${{ inputs.target }}
110121 *.cache-to=type=gha,mode=max,scope=${{ inputs.target }}
0 commit comments