1- name : Build, Test, and Publish Docker Images
1+ name : Docker
22
33on :
44 push :
4848 type=ref,event=pr,suffix=-dev-py${{ matrix.python-version }}
4949 type=semver,pattern={{version}},suffix=-dev-py${{ matrix.python-version }}
5050 type=semver,pattern={{major}}.{{minor}},suffix=-dev-py${{ matrix.python-version }}
51- type=raw,value=latest,enable={{is_default_branch}},suffix=-dev-py ${{ matrix.python-version }}
51+ type=raw,value=${{ github.ref == 'refs/heads/main' && 'dev' || format('{0}-dev', github.ref_name) }},enable= ${{ matrix.python-version == '3.13' }}
5252
5353 - name : Build dev image
5454 uses : docker/build-push-action@v6
@@ -58,12 +58,14 @@ jobs:
5858 target : dev
5959 push : false
6060 tags : ${{ steps.meta.outputs.tags }}
61- labels : ${{ steps.meta.outputs.labels }}
61+ # labels: ${{ steps.meta.outputs.labels }}
6262 build-args : |
6363 PYTHON_VERSION=${{ matrix.python-version }}
6464 cache-from : type=gha
6565 cache-to : type=gha,mode=max
6666 load : true
67+ provenance : false
68+ sbom : false
6769
6870 - name : Run tests in container
6971 run : |
@@ -81,10 +83,13 @@ jobs:
8183 target : dev
8284 push : true
8385 tags : ${{ steps.meta.outputs.tags }}
84- labels : ${{ steps.meta.outputs.labels }}
86+ # labels: ${{ steps.meta.outputs.labels }}
8587 build-args : |
8688 PYTHON_VERSION=${{ matrix.python-version }}
8789 cache-from : type=gha
90+ cache-to : type=gha,mode=max
91+ provenance : false
92+ sbom : false
8893
8994 build-and-push :
9095 needs : test-dev-container
@@ -96,10 +101,10 @@ jobs:
96101 strategy :
97102 matrix :
98103 include :
99- - target : pro
100- suffix : " "
101104 - target : pre
102105 suffix : " -pre"
106+ - target : pro
107+ suffix : " "
103108
104109 steps :
105110 - name : Checkout
@@ -125,7 +130,7 @@ jobs:
125130 type=ref,event=pr,suffix=${{ matrix.suffix }}
126131 type=semver,pattern={{version}},suffix=${{ matrix.suffix }}
127132 type=semver,pattern={{major}}.{{minor}},suffix=${{ matrix.suffix }}
128- type=raw,value=latest,enable={{is_default_branch}},suffix= ${{ matrix.suffix }}
133+ type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && matrix.target == 'pro' }}
129134
130135 - name : Build and push Docker image
131136 uses : docker/build-push-action@v6
@@ -135,6 +140,24 @@ jobs:
135140 target : ${{ matrix.target }}
136141 push : ${{ github.event_name != 'pull_request' }}
137142 tags : ${{ steps.meta.outputs.tags }}
138- labels : ${{ steps.meta.outputs.labels }}
143+ # labels: ${{ steps.meta.outputs.labels }}
139144 cache-from : type=gha
140- cache-to : type=gha,mode=max
145+ cache-to : type=gha,mode=max
146+ provenance : false
147+ sbom : false
148+
149+ cleanup-untagged :
150+ needs : [test-dev-container, build-and-push]
151+ runs-on : ubuntu-latest
152+ if : github.event_name != 'pull_request'
153+ permissions :
154+ packages : write
155+ steps :
156+ - name : Delete untagged images
157+ uses : actions/delete-package-versions@v5
158+ with :
159+ package-name : ' magg'
160+ package-type : ' container'
161+ delete-only-untagged-versions : ' true'
162+ min-versions-to-keep : 0
163+ token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments