Skip to content

Update cicd.yaml

Update cicd.yaml #2

Workflow file for this run

name: Build and Push Docker Image
on:
push:
branches:
- '**' # Triggers on push to any branch
- '!master' # Exclude master branch
pull_request:
branches:
- master # Triggers on PR to master branch
workflow_dispatch: # Manually trigger the workflow
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Docker image
run: docker build -t server .
- name: Log in to Docker Hub
uses: docker/login-action@v2
if: github.ref == 'refs/heads/master'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Docker image
if: github.ref == 'refs/heads/master'
run: docker push server:latest