Skip to content

Moved publish.yml to workflows directory #1

Moved publish.yml to workflows directory

Moved publish.yml to workflows directory #1

Workflow file for this run

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Publish Packages
on:
workflow_dispatch: # Allow running the workflow manually from the GitHub UI
push:
branches:
- 'main' # Run the workflow when pushing to the main branch
pull_request:
branches:
- '*' # Run the workflow for all pull requests
release:
types:
- published # Run the workflow when a new GitHub release is published
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
defaults:
run:
shell: pwsh
jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Install the .NET SDK indicated in the global.json file
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
# Restore packages dependencies
- name: Install dependencies
run: dotnet restore
# Build packages
- name: Build
run: dotnet build --configuration Release --no-restore
Deploy:
# Publish only when creating a GitHub Release
# https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
# You can update this logic if you want to manage releases differently
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: [ Build ]
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
# Restore packages dependencies
- name: Install dependencies
run: dotnet restore
# Build packages
- name: Build
run: dotnet build --configuration Release --no-restore
# Publish packages
- name: Publish package
run: dotnet pack --configuration Release --no-build --no-restore
- name: Push to NuGet
run: dotnet nuget push *.nupkg --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate