Build and Test #9
Workflow file for this run
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: Build and Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.x' | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: Run unit tests | |
run: dotnet test .\DocGpt.Test\DocGpt.Test.csproj --configuration Release | |
package-extension: | |
runs-on: windows-latest | |
steps: | |
- name: Setup MSBuild for NetFX | |
uses: microsoft/setup-msbuild@v2 | |
with: | |
vs-version: 17.0 | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: Bump version | |
run: | | |
# Set version number as '1.0.<gh workflow run number>' | |
$NEW_VERSION = "1.0.$env:GITHUB_RUN_NUMBER" | |
# Use PowerShell to update the version in the VSIX manifest | |
$xml = [xml](Get-Content -Path .\DocGpt.Vsix\source.extension.vsixmanifest) | |
$xml.SelectSingleNode('//Version').InnerText = $NEW_VERSION | |
$xml.OuterXml | Set-Content -Path .\DocGpt.Vsix\source.extension.vsixmanifest | |
- name: Restore NuGet packages | |
run: nuget restore .\DocGpt.sln | |
- name: Build Extension | |
run: msbuild .\DocGpt.sln -p:Configuration=Release | |
- name: Sign Extension | |
run: lib\win\openvsixsigntool.exe sign -t "http://timestamp.digicert.com" ".\DocGpt.Vsix\bin\Release\DocGPT.vsix" -kvu "https://${{ secrets.AZURE_KEYVAULT_NAME }}.vault.azure.net" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc "${{ secrets.SIGNING_CERTIFICATE_NAME }}" | |
- name: Publish Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: DocGpt.vsix | |
path: DocGpt.Vsix\bin\Release\DocGPT.vsix | |
# publish-to-marketplace: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Download artifact | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: my-artifact | |
# path: ./path/to | |
# - name: Publish to marketplace | |
# uses: cezarypiatek/VsixPublisherAction@1.1 | |
# with: | |
# extension-file: .\DocGpt.Vsix\bin\Release\DocGPT.vsix | |
# personal-access-code: ${{ secrets.VS_MARKETPLACE_TOKEN }} | |
# publish-manifest-file: .\DocGpt.Vsix\publishmanifest.json |