Example of automated deployment of .NET website to Windows Server. Windows Server is setup with IIS.
Here are instruction of the steps you must take to make automated deployments.
You can get instruction how to generate SSH keys for your platform on GitHub docs: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
Example:
ssh-keygen -t ed25519 -C "your_email@example.com" -f winUse instructions from Microsoft Docs: https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=gui&pivots=windows-server-2022
Generally OpenSSH Client is already installed. To install OpenSSH Server go:
Settings -> System -> Optional Features -> OpenSSH Server
Ensure OpenSSH Server starts Automatically after OS loads.
Use public SSH key you generated before.
Create .ssh folder in your user directory.
Put your public key into authorized_keys file.
In C:\ProgramData\ssh\sshd_config file ensure next settings:
- Key
PubkeyAuthenticationhasyesvalue. - Key
AuthorizedKeysFilehas.ssh/authorized_keysvalue as one of available.
Download Git and GitBash from: https://git-scm.com/downloads
It's required to make scp work properly. I learned it the hard way.
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\Git\usr\bin\bash.exe" -PropertyTag String -ForceMake new folder with your site name under C:\inetpub\wwwroot\.
Example: C:\inetpub\wwwroot\Site.
Deployments will be placed in subfolders of this folder.
Copy scripts/update.ps1 script from the repository into created folder and adjust it to match site name.
Use workflows from this repository. Change build.yaml workflow as it suits your project.
Also change deploy.yaml workflow to match your site's folder name.
