Publish Global Tool #7
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: Publish Global Tool | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version of the global tool to build and publish' | |
required: true | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v4 | |
- name: Set up .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build global tool | |
env: | |
VERSION: ${{ inputs.version }} | |
run: dotnet pack -c Release -p:Version=$VERSION --output ./artifacts | |
- name: Publish global tool to NuGet.org | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
run: dotnet nuget push ./artifacts/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json |