Skip to content

GHA for publishing vsix. [skip publish nuget] [force publish vsix] #35

GHA for publishing vsix. [skip publish nuget] [force publish vsix]

GHA for publishing vsix. [skip publish nuget] [force publish vsix] #35

Workflow file for this run

name: Main
defaults:
run:
shell: pwsh
on:
push:
branches:
- 'main'
# - 'develop'
- 'release/**'
- 'feature/**'
- 'hotfix/**'
- 'gha-test'
paths-ignore:
- '.github/ISSUE_TEMPLATE/**'
- '*.md'
- 'docs/**'
env:
CICD: 1
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# non-shallow fetch of Git history allows correct version calculation.
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
- name: Setup msbuild
uses: microsoft/[email protected]
- name: Restore tools
run: dotnet tool restore
- name: Use GitVersion
id: gitversion
run: echo "version=$(dotnet gitversion -output json -showvariable NuGetVersionV2)" >> $GITHUB_OUTPUT
- name: Restore dependencies
run: .\scripts\Restore.ps1
- name: Build
run: .\scripts\Build.ps1
- name: Test
run: .\scripts\Test.ps1
- name: Pack
run: $Env:GitVersion_NuGetVersionV2='${{ steps.gitversion.outputs.version }}'; .\scripts\Pack.ps1
- name: Collect vsix
run: Get-ChildItem -Path .\src\NullGC.Analyzer.Vsix\bin\Release\ -Filter *.vsix -Recurse | Copy-Item -Destination .\artifacts\
- name: Upload vsix
uses: actions/upload-artifact@v4
with:
name: vsix
path: './artifacts/**/NullGC.Analyzer.Vsix.vsix'
- name: Publish NuGet packages
if: ${{ !contains(github.event.head_commit.message, '[skip publish nuget]') }}
run: $Env:NUGET_API_KEY='${{ secrets.NUGET_API_KEY }}'; .\scripts\PublishNuget.ps1
publish-vsix:
needs: build
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
src:
- 'src/NullGC.Analyzer*/**'
- name: Download artifacts
if: ${{ contains(github.event.head_commit.message, '[force publish vsix]') || steps.changes.outputs.src == 'true' }}
uses: actions/download-artifact@v4
with:
name: vsix
- name: Dir
run: ls
- name: Publish vsix to marketplace
if: ${{ contains(github.event.head_commit.message, '[force publish vsix]') || steps.changes.outputs.src == 'true' }}
uses: cezarypiatek/[email protected]
with:
extension-file: ./NullGC.Analyzer.Vsix.vsix
publish-manifest-file: ./VsixPublishManifest.json
personal-access-code: ${{ secrets.MARKETPLACE_APIKEY }}