Skip to content

feat: add cicd workflow for automation #1

feat: add cicd workflow for automation

feat: add cicd workflow for automation #1

Workflow file for this run

name: Main Branch CI/CD
on:
push:
branches: ["main"]
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set Docker image tags
run: |
echo "TAG=production-latest" >> $GITHUB_ENV
echo "SHA_TAG=$GITHUB_SHA" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/devops:${{ env.TAG }}
${{ secrets.DOCKERHUB_USERNAME }}/devops:${{ env.SHA_TAG }}