Skip to content

Commit cca761b

Browse files
committed
feat: add cicd workflow for automation
1 parent 0f48d21 commit cca761b

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/cicd.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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 }}

0 commit comments

Comments
 (0)