Skip to content

Changed branch name in ci-cd.yml #1

Changed branch name in ci-cd.yml

Changed branch name in ci-cd.yml #1

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and Push Docker Image
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
docker build -t your-dockerhub-username/grafana-prometheus:latest .
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker push your-dockerhub-username/grafana-prometheus:latest
- name: Deploy to Production
if: github.ref == 'refs/heads/main'
run: |
ssh user@your-server 'docker-compose -f /path/to/docker-compose.yml pull'
ssh user@your-server 'docker-compose -f /path/to/docker-compose.yml up -d'