Skip to content

Commit

Permalink
(Add): - Adding GitHub Actions workflow for CONSORCIO API
Browse files Browse the repository at this point in the history
  • Loading branch information
RiandryDevelop authored Dec 23, 2024
1 parent c223666 commit 75652e8
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CONSORCIO API CI/CD

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout code from the repository
- name: Checkout code
uses: actions/checkout@v3

# Step 2: Set up .NET environment
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0 # Specify .NET 6.0 from your .csproj file

# Step 3: Restore dependencies
- name: Restore dependencies
run: dotnet restore

# Step 4: Build the project
- name: Build
run: dotnet build --no-restore --configuration Release

# Step 5: Run tests (optional)
- name: Run tests
run: dotnet test --no-build --verbosity normal

# Step 6: Publish the project
- name: Publish
run: dotnet publish -c Release -o out

docker:
needs: build
runs-on: ubuntu-latest

steps:
# Step 1: Checkout code
- name: Checkout code
uses: actions/checkout@v3

# Step 2: Log in to Docker Hub (replace credentials)
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

# Step 3: Build the Docker image
- name: Build Docker image
run: docker build -f Dockerfile -t your-dockerhub-username/consorcio-api:latest .

# Step 4: Push the Docker image to Docker Hub
- name: Push Docker image
run: docker push your-dockerhub-username/consorcio-api:latest

0 comments on commit 75652e8

Please sign in to comment.