I am using Github as my source control, and using Github Actions as my CI/CD solution. I have a dedicated Windows Server somewhere, which accepts the published version of my repo.
I have a Github Action, which does Built, Test, Publish and Deploy (using FTP). I am not convinced with the "Deploy" idea. for example lets say my website has a huge codebase, and then FTPing everytime when we make a commit (Push) is NOT really a productive idea (i am publishing the published directory...not the Source Code to my server). Sometimes FTPing simply does not work, due to IIS Locking the files. what is the most reliable way to publish/deploy files to a remote server using Github Actions (or any other provider).
below is my sample Yaml file...
name: .NET Core
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal
- name: Run the Publish
run: dotnet publish --configuration Release --no-restore --output ./publish
- name: FTP-Deploy-Action
uses: sebastianpopp/ftp-action@releases/v2
with:
host: my_host
user: my_user
password: ${{ secrets.FTP_PASSWORD }}
localDir: "/home/runner/work/CiTest/CiTest/CiTest/publish"
remoteDir: "CI-Test"