File tree Expand file tree Collapse file tree 2 files changed +57
-1
lines changed Expand file tree Collapse file tree 2 files changed +57
-1
lines changed Original file line number Diff line number Diff line change 1+ name : Create and publish a Docker image
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ tags :
8+ - " v*"
9+ workflow_dispatch :
10+
11+ env :
12+ REGISTRY : ghcr.io
13+ IMAGE_NAME : ${{ github.repository }}
14+
15+ jobs :
16+ build-and-push-image :
17+ runs-on : ubuntu-latest
18+ permissions :
19+ contents : read
20+ packages : write
21+ attestations : write
22+ id-token : write
23+ steps :
24+ - name : Checkout repository
25+ uses : actions/checkout@v4
26+ - name : Log in to the Container registry
27+ uses : docker/login-action@v3
28+ with :
29+ registry : ${{ env.REGISTRY }}
30+ username : ${{ github.actor }}
31+ password : ${{ secrets.GHCR_PASSWD }}
32+ - name : Extract metadata (tags, labels) for Docker
33+ id : meta
34+ uses : docker/metadata-action@v5
35+ with :
36+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
37+ -
uses :
benjlevesque/[email protected] 38+ id : short-sha
39+ with :
40+ length : 7
41+ - name : Build and push Docker image
42+ id : push
43+ uses : docker/build-push-action@v6
44+ with :
45+ context : .
46+ push : ${{ github.event_name != 'pull_request' }}
47+ tags : |
48+ ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
49+ ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.SHA }}
50+ labels : ${{ steps.meta.outputs.labels }}
51+ - name : Generate artifact attestation
52+ uses : actions/attest-build-provenance@v2
53+ with :
54+ subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
55+ subject-digest : ${{ steps.push.outputs.digest }}
56+ push-to-registry : true
Original file line number Diff line number Diff line change 99# File Created: 2025-03-05 11:10:40
1010#
1111# Modified By: mingcheng ([email protected] )12- # Last Modified: 2025-03-18 14:54:55
12+ # Last Modified: 2025-03-17 18:29:18
1313# #
1414
1515name : Cargo Build & Test
You can’t perform that action at this time.
0 commit comments