Skip to content

ci: support package publish (#17) #1

ci: support package publish (#17)

ci: support package publish (#17) #1

Workflow file for this run

name: Package
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
permissions:
contents: read
jobs:
nuget:
runs-on: ubuntu-latest
steps:
- name: 🛡️ Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit
- name: 🛒 Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: ✨ Setup .NET
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
with:
dotnet-version: 6.0.x
- name: 🛠️ Setup NuGet cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props') }}
restore-keys: ${{ runner.os }}-nuget-
- name: 📦 Pack
run: dotnet pack /p:CI=true /p:PublicRelease=true -c Release
- name: 🚀 Publish
run: dotnet nuget push "artifacts/*.nupkg" -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_APIKEY }} --skip-duplicate