Skip to content

Update to use msbuild instead of dotnet #58

Update to use msbuild instead of dotnet

Update to use msbuild instead of dotnet #58

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: "Build"
permissions:
actions: write
contents: write
env:
VERSION: 1.0.${{ github.run_number }}
NUGET_REPO_URL: "https://api.nuget.org/v3/index.json"
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Sets environment variables - branch-name
uses: nelonoel/branch-name@v1.0.1
- name: Sets environment variables - Nerdbank.GitVersioningi
uses: dotnet/nbgv@master
with:
setAllVars: true
- name: Update Version
run: |
(Get-Content -Path NoVar/source.extension.vsixmanifest -Raw) -Replace 'Version="1.0.0"', 'Version="${{ env.VERSION }}"' | Set-Content -Path NoVar/source.extension.vsixmanifest
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore
run: dotnet restore NoVarExtension.sln
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
- name: Build
run: msbuild NoVarExtension.sln /property:Configuration=Release /t:Rebuild
- name: Install NUnit.ConsoleRunner
run: nuget install NUnit.ConsoleRunner -Version 3.13.0 -DirectDownload -OutputDirectory .
- name: Run UnitTests
run: ./NUnit.ConsoleRunner.3.13.0/tools/nunit3-console.exe NoVarTest/bin/Release/net8.0-windows/NoVarTests.dll
- name: Move build output
run: mv bin/Release/NoVar.vsix NoVar-${{ env.VERSION }}.vsix
working-directory: NoVar
- name: Publish artifacts
uses: actions/upload-artifact@v4
with:
name: Visual Studio Extension
path: Novar/*.vsix
- name: Publish VSIX Packages
continue-on-error: true
run: |
$VsixPublisher = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe"
& $VsixPublisher login -personalAccessToken "${{ secrets.PERSONALACCESSTOKEN }}" -publisherName PrabhathKiranAtmakuri
& $VsixPublisher publish -payload Novar/NoVar-${{ env.VERSION }}.vsix -publishManifest NoVar/publish-manifest.json -ignoreWarnings 'VSIXValidatorWarning01,VSIXValidatorWarning02'
- name: debug
run: |
echo $env:VERSION
echo (Get-Content -Path NoVar/source.extension.vsixmanifest -Raw)
Tag:
needs: build
runs-on: ubuntu-latest
steps:
- name: Create tag
uses: actions/github-script@v7
with:
github-token: ${{ github.token }}
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ env.VERSION }}",
sha: context.sha
})
- name: Create release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: v${{ env.VERSION }}
draft: true
prerelease: false
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Upload VSIX asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: artifacts/Visual Studio Extension/NoVar-${{ env.VERSION }}.vsix
asset_name: NoVar-${{ env.VERSION }}.vsix
asset_content_type: application/zip