How to use github actions to auto publish your website file to our server.

Control Panel V5

1>Locate the repository you want to automate Simply web deployment in.
 
2>Select the "Actions" tab.
 
3>Select  "Set up a workflow yourself".
 
4>Copy and paste the below code into your .yml workflow file and commit the file. (replace server, username, and password with your own FTP login credentials.)
 
name: Build project and deploy to myWindowsHosting.com
on: [push]

jobs:
  build_and_deploy:
    name: Build package and deploy to myWindowsHosting.com
    runs-on: windows-latest
    steps:
      - name: build file
        uses: actions/checkout@v4

      - name: Sync files
        uses: SamKirkland/FTP-Deploy-Action@v4.3.4
        with:
          server: winxxxx.site4now.net
          username: xxxxxx
          password: xxxxxxxxxxx
If you do not want to use the FTP method you can use the web deploy method too, and here is an example .yml file to publish the .net core site. (replace website-name,server-computer-name, server-username, server-password, and source-path with your own web deploy info.)
name: Build, publish and deploy project to Simply

on: [push]

jobs:
  build_and_deploy:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup .NET Core
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 8.0
          
      - name: Install dependencies
        run: dotnet restore
        
      - name: Build
        run: dotnet build --configuration Release --no-restore

      - name: Publish
        run: dotnet publish
        
      - name: Test with .NET
        run: dotnet test

      - name: Deploy to Simply        
        uses: talunzhang/auto-web-deploy@v1.0.1
        with:
          website-name: xxxxxx-00x-xxxx
          server-computer-name: https://winxxxx.site4now.net:8172
          server-username: xxxxxx
          server-password: xxxxxxxx
          source-path: '\xxxxx\xxxxx\xxxxx\release\'
If you need to publish the database simultaneously, please add the below step to your .yml file.
 
- name: Migrate
run: |
dotnet tool install --global dotnet-ef
dotnet ef database update --connection "<your_database_connection_string>"
 
 
5>Also you can set the login credentials to "Secrects" to protect your login credentials, then call it with .yml file like the below code, this can be found in the "Settings" section.
 
server: ${{ secrets.SERVER_FTP_SERVER }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
website-name: ${{ secrets.WEBSITE_NAME }}
server-computer-name: ${{ secrets.SERVER_COMPUTER_NAME }}
server-username: ${{ secrets.SERVER_USERNAME }}
server-password: ${{ secrets.SERVER_PASSWORD }}
please make sure you have set those info with Settings>>Secrets and variables>>Actions>>New repository secret then you can use it. Below the form are the related settings detailed info.
 
Setting Required Example Default Value Description
website-name Yes sub.example.com   Deployment destination server
server-computer-name Yes https://winxxxx.site4now.net:8172   Computer name, including the port - Find hotsing Control Panel
server-username Yes username   Your Simply FTP username
server-password Yes password   Your Simply FTP password
source-path No \my-build\dist\ \publish\ The path to the source directory that will be deployed
target-path No /sub-directory/ '' (Root of your website) The path where the source directory will be deployed (relative to website root)
target-delete No true false Delete files on the target computer that do not exist on the source computer
 
 
6>Once you have added your secrets, your new workflow should be running on every push to the branch. If you need more function with your GitHub action you can custom it too.