.NET Core Desktop #840
This file contains 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: .NET Core Desktop | |
on: | |
push: | |
branches: [main] | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 | |
pull_request: | |
branches: [main] | |
schedule: | |
- cron: "0 2 * * *" | |
jobs: | |
build: | |
runs-on: | |
windows-2019 # For a list of available runner types, refer to | |
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on | |
env: | |
Solution_Name: Acrolinx.Demo.Sidebar.Net.sln | |
NUGET_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: mkdir download | |
run: mkdir download | |
- name: download sonar | |
run: powershell Invoke-WebRequest -Uri "https://github.com/SonarSource/sonar-scanner-msbuild/releases/download/5.13.0.66756/sonar-scanner-msbuild-5.13.0.66756-net46.zip" -OutFile ".\download\sonarmsbuild.zip" | |
- name: extract sonar | |
run: powershell Expand-Archive .\download\sonarmsbuild.zip .\sonar-msbuild\ | |
# Install the .NET Core workload | |
- name: Install .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 5.0.x | |
- name: Nuget restore | |
uses: nuget/setup-nuget@v1 | |
- run: nuget restore $env:Solution_Name | |
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild | |
- name: Setup MSBuild.exe | |
uses: microsoft/setup-msbuild@3404ff3d40458f8d1fdf55c2bcc442b970404ad7 | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
- name: Setup Java - required by sonar | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Set version from tag name | |
if: startsWith(github.ref,'refs/tags/v') | |
shell: powershell | |
run: .\patch-assembly.ps1 | |
- name: begin sonar | |
env: | |
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} | |
run: sonar-msbuild\SonarScanner.MSBuild.exe begin /o:"acrolinx" /k:"acrolinx_acrolinx-sidebar-demo-dotnet" /d:sonar.token=$env:SONAR_TOKEN /d:sonar.host.url="https://sonarcloud.io" | |
# Restore the application to populate the obj folder with RuntimeIdentifiers | |
- name: Restore the application | |
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=Release | |
- name: Build the application | |
run: msbuild $env:Solution_Name /p:Configuration=Release | |
- name: end sonar | |
env: | |
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} | |
run: sonar-msbuild\SonarScanner.MSBuild.exe end /d:sonar.token=$env:SONAR_TOKEN | |
- name: tree | |
run: tree | |
- uses: actions/upload-artifact@master | |
with: | |
name: build-artifact | |
path: .\Acrolinx.Demo.Sidebar\bin\Release\ | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
if: startsWith(github.ref,'refs/tags/v') | |
steps: | |
- uses: actions/download-artifact@master | |
with: | |
name: build-artifact | |
path: ./Release/ | |
- name: create zip | |
run: zip sidebar-demo-dotnet.zip ./Release/* | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ./sidebar-demo-dotnet.zip |