Skip to content

Manual-Nuget-Publish #28

Manual-Nuget-Publish

Manual-Nuget-Publish #28

# This is a basic workflow that is manually triggered
name: Manual-Nuget-Publish
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: windows-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
# - name: Correct for GitVersion
# run: |
# git fetch --prune --unshallow
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.6
with:
versionSpec: '5.x'
- name: Use GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.6
- name: Output version
run: |
echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}"
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Resotre Nuget Packages
run: dotnet restore NationalInstruments.Analyzers.sln
- name: Build App
run: dotnet build NationalInstruments.Analyzers.sln --configuration release --no-restore
- name: Run Tests
run: dotnet test NationalInstruments.Analyzers.sln
- name: Pack Nuget Package
run: dotnet pack .\src\NationalInstruments.Analyzers\NationalInstruments.Analyzers.csproj -p:NuspecFile=../../build/NI.CSharp.Analyzers.nuspec --no-build -p:NuspecProperties="Version=${{ steps.gitversion.outputs.nuGetVersionV2 }}"
- name: Publish Nuget Package
run: dotnet nuget push .\.binaries\NationalInstruments.Analyzers\*.nupkg --skip-duplicate --no-symbols --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json