Skip to content

Update : added CI CD pipeline for main branch #2

Update : added CI CD pipeline for main branch

Update : added CI CD pipeline for main branch #2

Workflow file for this run

name: CI & CD Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Run tests
run: dotnet test --no-restore --verbosity normal
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Send files to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USERNAME }}
password: ${{ secrets.VPS_PWD }}
port: ${{ secrets.VPS_PORT }}
source: keep-this
target: .
- name: SSH to VPS and deploy
uses: appleboy/ssh-action@v0.1.0
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.SSH_KEY }}
script: |
cd keep-this
docker-compose down
docker-compose pull
docker-compose up -d