Some tips for Windows development and GitHub Actions
- Be careful of calls that might end up needing user input! For example, make sure to run installers in a quiet/no prompt mode. The runner will wait for user feedback that won't come.
- I've had mixed luck with more windows-centric GitHub Actions. Feel free to explore the Marketplace, but you may find it easier to just call out to shell or powershell.
- By following some error messages, I figured out the "install path", at least at the moment, (see either the create-release-zip or build-and-test examples for more info on where this goes in the workflow yaml file).
jobs: build: env: msbuild-path: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin vstest-path: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\TestPlatform
- It seems at some point the default shell for the "run" set command changed from cmd to powershell. If you're reading older examples, it may need a "shelL: cmd" added to the step if you're seeing syntax errors. For example:
- name: Restore Nuget Packages run: "\"${{ env.msbuild-path }}\\MSBuild.exe\" -t:restore -p:RestorePackagesConfig=true -p:Configuration=Release ${{github.workspace }}\\exampleapp\\exampleapp.sln" shell: cmd
- A probably dangerous move, but if there's stuff you want to do to a github repository / team /etc based on triggers in github, you can install and use the PowerShellForGitHub Powershell module and use a Personal Access Token (and probably SSO "signing" it) and set it up as a GitHub Secret. For more details, see the Powershll and Github section below
PowerShellForGitHub
The PowerShellForGitHub pages are pretty brief, but you can get a lot of information by using the Get-Help cmdlet. For example:
Get-Help Set-GitHubAuthentication -ShowWindowor just examples like
Get-Help Set-GitHubAuthentication -Examples