Skip to content

Update dotnet.yml

Update dotnet.yml #25

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# release:
# types:
# - published # Run the workflow when a new GitHub release is published
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
VisxDirectory: ${{github.workspace}}/vsix
Version: '2.1.0.${{ github.run_number }}'
BaseVersion: '2.1.0.0'
defaults:
run:
shell: pwsh
jobs:
build:
runs-on: [windows-latest]
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0 # Get all history to allow automatic versioning using MinVer
- name: Setup MsBuild
uses: microsoft/setup-msbuild@v2
- name: Setup VSTest.console.exe
# You may pin to the exact commit or the version.
# uses: darenm/Setup-VSTest@d9a5dffa3f11d9c27ec42eb69515d3aaeaad9ef8
uses: darenm/[email protected]
- name: Setup NuGet.exe
# You may pin to the exact commit or the version.
# uses: NuGet/setup-nuget@296fd3ccf8528660c91106efefe2364482f86d6f
uses: NuGet/[email protected]
- name: Update Visual Studio Extension version
uses: cezarypiatek/[email protected]
with:
version: ${{ env.Version }}
vsix-manifest-file: 'Manifests\vs2022\source.extension.vsixmanifest'
- name: Update assembly version
run: |
(Get-Content -Path CodeDocumentor\Settings\VsixOptions.cs) |
ForEach-Object {$_ -Replace '${{ env.BaseVersion }}', '${{ env.Version }}'} |
Set-Content -Path CodeDocumentor\Settings\VsixOptions.cs
- name: Restore dependencies
run: nuget restore CodeDocumentor.sln
- name: Build
run: msbuild CodeDocumentor.sln /p:configuration="Release" /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal
- name: Test
run: vstest.console.exe CodeDocumentor.Test\bin\Release\net48\CodeDocumentor.Test.dll
- uses: actions/[email protected]
name: "Pack"
with:
name: "CodeDocumentor.vsix"
path: CodeDocumentor\bin\Release\CodeDocumentor.vsix
# deploy:
# # Publish only when creating a GitHub Release
# # https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
# # You can update this logic if you want to manage releases differently
# if: github.event_name == 'release'
# runs-on: [windows-latest]
# needs: [ build ]
# steps:
# # Download the NuGet package created in the previous job
# - uses: actions/[email protected]
# with:
# name: "CodeDocumentor.vsix"
# - name: Publish extension to Marketplace
# uses: cezarypiatek/[email protected]
# with:
# extension-file: 'CodeDocumentor.vsix'
# publish-manifest-file: 'CodeDocumentor\CodeDocumentor.vsix\manifest.json'
# personal-access-code: ${{ secrets.VS_PUBLISHER_ACCESS_TOKEN }}