Create dotnet.yml #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Deploy Windows Forms App | |
| on: | |
| push: | |
| branches: | |
| - main # Trigger the workflow on pushes to the main branch | |
| pull_request: | |
| branches: | |
| - main # Trigger the workflow for pull requests targeting the main branch | |
| jobs: | |
| build: | |
| runs-on: windows-latest # Use a Windows runner to build a .NET Framework Windows Forms app | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 # Check out the code from the repository | |
| - name: Set up .NET Framework build tools | |
| run: | | |
| # Install .NET Framework build tools if needed (e.g., Visual Studio Build tools) | |
| choco install visualstudio2019buildtools --package-parameters "--add Microsoft.VisualStudio.Component.Windows10SDK" -y | |
| choco install microsoft-build-tools --version=16.8.2 -y | |
| - name: Restore NuGet packages | |
| run: nuget restore YourProject.sln # Restore the NuGet packages for your solution | |
| - name: Build the project | |
| run: msbuild YourProject.sln /p:Configuration=Release # Build the project in Release mode | |
| - name: Run tests (Optional) | |
| run: | | |
| # Run tests if you have unit tests (if applicable) | |
| vstest.console YourProject.Tests.dll # Replace with the actual test DLL if applicable | |
| - name: Publish the application | |
| run: | | |
| msbuild YourProject.sln /p:Configuration=Release /p:OutputPath=./output # Publish the app to the output folder | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v2 | |
| with: | |
| name: BetterSoundMeeter-WindowsForms | |
| path: ./output # Upload the build output as an artifact for later use | |
| # Optional deployment job (e.g., if you need to deploy to a server) | |
| deploy: | |
| runs-on: windows-latest # You can use the same or another Windows runner for deployment | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v2 | |
| with: | |
| name: BetterSoundMeeter-WindowsForms | |
| - name: Deploy application | |
| run: | | |
| # Add your deployment steps here, e.g., copying the files to a server, creating a release, etc. | |
| echo "Deploying BetterSoundMeeter..." # Placeholder for deployment logic |