-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c9bec5b
commit 03cbebd
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: .NET MVC CI/CD Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Trigger on push to 'main' branch | ||
pull_request: | ||
branches: | ||
- main # Trigger on pull request to 'main' branch | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
DOTNET_VERSION: 8.0 | ||
PUBLISH_DIR: ./publish | ||
IMAGE_NAME: ragh2404/demoMvcCore # Docker image name | ||
|
||
steps: | ||
# Step 1: Check out code | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
# Step 2: Set up .NET | ||
- name: Setup .NET SDK | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
||
# Step 3: Restore dependencies | ||
- name: Restore dependencies | ||
run: dotnet restore | ||
|
||
# Step 4: Build the solution | ||
- name: Build the solution | ||
run: dotnet build --configuration Release | ||
|
||
# Step 6: Build Docker Image | ||
- name: Build Docker Image | ||
run: | | ||
docker build -t ${{ env.IMAGE_NAME }}:latest . | ||
# Step 7: Log in to DockerHub (or your preferred registry) | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: raghav2404l | ||
password: Rr24042000#Rr | ||
|
||
# Step 8: Push Docker image to DockerHub | ||
- name: Push Docker Image to Docker Hub | ||
run: | | ||
docker push ${{ env.IMAGE_NAME }}:latest |