Skip to content

Publish Global Tool

Publish Global Tool #5

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