1- name : Publish WhyGraph Docker image
1+ name : cd-deploy-whygraph
22
33# Builds and pushes ghcr.io/mtrdesign/whygraph — the self-contained
44# scanning-service image the `whygraph` host shim (scripts/install.sh)
5- # runs. Triggers:
6- # - any push to main that touches the image, the package source, or this workflow
7- # - manual workflow_dispatch (with optional pinned codegraph version + release tag)
5+ # runs. Publishing is tied to releases: cutting a GitHub release (tagged
6+ # vX.Y.Z) builds the image and tags it to match that version, so the image
7+ # tag follows the release version 1:1.
88
99on :
10- push :
11- branches : [main]
12- paths :
13- - ' docker/whygraph/**'
14- - ' src/whygraph/**'
15- - ' pyproject.toml'
16- - ' .github/workflows/publish-whygraph-image.yml'
17- workflow_dispatch :
18- inputs :
19- codegraph_version :
20- description : ' npm version of @colbymchenry/codegraph to bake in (e.g. 1.2.3 or "latest")'
21- required : false
22- default : ' latest'
23- release_tag :
24- description : ' Optional human-readable release tag (e.g. v1.2.3) — published alongside :latest and :sha-XXXX'
25- required : false
26- default : ' '
10+ release :
11+ types : [published]
2712
2813permissions :
2914 contents : read
3015 packages : write
3116
3217jobs :
3318 build-and-push :
19+ name : Build and push image
3420 runs-on : ubuntu-latest
3521 steps :
3622 - name : Checkout
@@ -49,15 +35,20 @@ jobs:
4935 username : ${{ github.actor }}
5036 password : ${{ secrets.GITHUB_TOKEN }}
5137
38+ # The release tag drives the image tags. A release `v1.2.3` publishes
39+ # :1.2.3, :1.2, :1 and :latest, so consumers can pin as loosely or as
40+ # tightly as they like while the shim's default :latest tracks the
41+ # newest release.
5242 - name : Compute image tags
5343 id : meta
5444 uses : docker/metadata-action@v5
5545 with :
5646 images : ghcr.io/mtrdesign/whygraph
5747 tags : |
58- type=raw,value=latest,enable={{is_default_branch}}
59- type=sha,prefix=sha-
60- type=raw,value=${{ github.event.inputs.release_tag }},enable=${{ github.event.inputs.release_tag != '' }}
48+ type=semver,pattern={{version}}
49+ type=semver,pattern={{major}}.{{minor}}
50+ type=semver,pattern={{major}}
51+ type=raw,value=latest
6152
6253 - name : Build and push
6354 uses : docker/build-push-action@v6
6960 tags : ${{ steps.meta.outputs.tags }}
7061 labels : ${{ steps.meta.outputs.labels }}
7162 build-args : |
72- CODEGRAPH_VERSION=${{ github.event.inputs.codegraph_version || ' latest' }}
63+ CODEGRAPH_VERSION=latest
7364 cache-from : type=gha
7465 cache-to : type=gha,mode=max
0 commit comments