File tree Expand file tree Collapse file tree 1 file changed +72
-0
lines changed
Expand file tree Collapse file tree 1 file changed +72
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Docker Image CI
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ pull_request :
8+ branches :
9+ - main
10+
11+ permissions :
12+ id-token : write
13+ contents : read
14+
15+ jobs :
16+ build :
17+ runs-on : ubuntu-latest
18+
19+ steps :
20+ - name : Checkout the repository
21+ uses : actions/checkout@v3
22+
23+ - name : Install Cosign
24+ uses : sigstore/cosign-installer@v3.6.0
25+
26+ - name : Set up Docker Buildx
27+ uses : docker/setup-buildx-action@v2
28+
29+ - name : Log in to Docker Hub
30+ uses : docker/login-action@v2
31+ with :
32+ username : ${{ secrets.DOCKER_HUB_USERNAME }}
33+ password : ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
34+
35+ - name : " Setup Docker Meta"
36+ id : docker_meta
37+ uses : docker/metadata-action@v4.4.0
38+ with :
39+ images : ${{ secrets.DOCKER_HUB_USERNAME }}/btc
40+ tags : |
41+ type=sha,format=long
42+ type=raw,value=latest
43+
44+ - name : Debug tags
45+ id : debug
46+ run : |
47+ echo "Tags value is : ${{ steps.docker_meta.outputs.tags }}"
48+
49+ - name : Build and push Docker image
50+ id : build-and-push
51+ uses : docker/build-push-action@v5
52+ with :
53+ context : .
54+ file : ./Dockerfile
55+ push : true
56+ tags : ${{ steps.docker_meta.outputs.tags }}
57+
58+ - name : Sign the images with GitHub OIDC Token
59+ env :
60+ DIGEST : ${{ steps.build-and-push.outputs.digest }}
61+ TAGS : ${{ steps.docker_meta.outputs.tags }}
62+ run : |
63+ images=""
64+ for tag in ${TAGS}; do
65+ images+="${tag}@${DIGEST} "
66+ done
67+ cosign sign --yes ${images}
68+
69+ - name : Logout from Docker Hub
70+ run : docker logout
71+
72+
You can’t perform that action at this time.
0 commit comments