File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Main Branch CI/CD
2+
3+ on :
4+ push :
5+ branches : ["main"]
6+
7+ jobs :
8+ build-and-push :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - name : Checkout code
12+ uses : actions/checkout@v4
13+
14+ - name : Login to Docker Hub
15+ uses : docker/login-action@v3
16+ with :
17+ username : ${{ secrets.DOCKERHUB_USERNAME }}
18+ password : ${{ secrets.DOCKERHUB_TOKEN }}
19+
20+ - name : Set Docker image tags
21+ run : |
22+ echo "TAG=production-latest" >> $GITHUB_ENV
23+ echo "SHA_TAG=$GITHUB_SHA" >> $GITHUB_ENV
24+
25+ - name : Build and push Docker image
26+ uses : docker/build-push-action@v5
27+ with :
28+ context : .
29+ push : true
30+ tags : |
31+ ${{ secrets.DOCKERHUB_USERNAME }}/devops:${{ env.TAG }}
32+ ${{ secrets.DOCKERHUB_USERNAME }}/devops:${{ env.SHA_TAG }}
You can’t perform that action at this time.
0 commit comments