44 push :
55 branches :
66 - main
7- - develop
87 tags :
9- - " v*.*.*" # Semantic versioning tags (v1.0.0, v1.2.3, etc.)
8+ - " v*.*.*" # Match version tags like v1.2.3
109 pull_request :
1110 branches :
1211 - main
@@ -49,27 +48,26 @@ jobs:
4948 - name : Extract metadata (tags, labels) for Docker
5049 id : meta
5150 uses : docker/metadata-action@v5
51+ env :
52+ DOCKER_METADATA_SHORT_SHA_LENGTH : 7
5253 with :
5354 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
5455 tags : |
55- # Tag with branch name for branch pushes
56- type=ref,event=branch
57- # Tag with PR number for pull requests
58- type=ref,event=pr
59- # Tag with git tag for version releases
60- type=semver,pattern={{version}}
61- type=semver,pattern={{major}}.{{minor}}
62- type=semver,pattern={{major}}
63- # Tag with short SHA
64- type=sha,format=short
65- # Tag latest only on main branch
56+ type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
57+ type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
58+ # # disabled if major zero
59+ # type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
60+ type=sha,enable=true,priority=100,prefix=,suffix=,format=short
61+ type=schedule,pattern={{date 'YYYYMMDD'}}
6662 type=raw,value=latest,enable={{is_default_branch}}
6763 labels : |
6864 org.opencontainers.image.title=aigitcommit
6965 org.opencontainers.image.description=AI-powered Git commit message generator
70- org.opencontainers.image.vendor=Hangzhou Guanwaii Technology Co,.Ltd.
66+ org.opencontainers.image.url=https://github.com/mingcheng/aigitcommit
67+ org.opencontainers.image.vendor=${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
7168
7269 - name : Build and push Docker image
70+ if : steps.meta.outputs.tags != ''
7371 id : push
7472 uses : docker/build-push-action@v6
7573 with :
@@ -85,33 +83,26 @@ jobs:
8583 VCS_REF=${{ github.sha }}
8684 VERSION=${{ steps.meta.outputs.version }}
8785
88- - name : Generate artifact attestation
89- if : github.event_name != 'pull_request'
90- uses : actions/attest-build-provenance@v2
91- with :
92- subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
93- subject-digest : ${{ steps.push.outputs.digest }}
94- push-to-registry : true
95-
96- - name : Generate SBOM
97- if : github.event_name != 'pull_request'
98- uses : anchore/sbom-action@v0
99- with :
100- image : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.push.outputs.digest }}
101- format : spdx-json
102- output-file : sbom.spdx.json
86+ # - name: Generate artifact attestation
87+ # if: github.event_name != 'pull_request'
88+ # uses: actions/attest-build-provenance@v3
89+ # with:
90+ # subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
91+ # subject-digest: ${{ steps.push.outputs.digest }}
92+ # push-to-registry: false
10393
104- - name : Upload SBOM as artifact
105- if : github.event_name != 'pull_request'
106- uses : actions/upload-artifact@v4
107- with :
108- name : sbom- ${{ github.sha }}
109- path : sbom. spdx. json
110- retention-days : 90
94+ # - name: Generate SBOM
95+ # if: github.event_name != 'pull_request'
96+ 97+ # with:
98+ # image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.push.outputs.digest }}
99+ # format: spdx- json
100+ # output-file: sbom.spdx.json
111101
112- - name : Image digest
113- if : github.event_name != 'pull_request'
114- run : |
115- echo "Image pushed successfully!"
116- echo "Digest: ${{ steps.push.outputs.digest }}"
117- echo "Tags: ${{ steps.meta.outputs.tags }}"
102+ # - name: Upload SBOM as artifact
103+ # if: github.event_name != 'pull_request'
104+ # uses: actions/upload-artifact@v4
105+ # with:
106+ # name: ${{ steps.short-sha.outputs.sha }}-sbom
107+ # path: sbom.spdx.json
108+ # retention-days: 90
0 commit comments