44 lines
1.1 KiB
YAML
44 lines
1.1 KiB
YAML
name: .NET Build and Publish
|
|
|
|
on:
|
|
push:
|
|
tags: ["*.*.*"]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
environment:
|
|
name: 'nuget.org'
|
|
permissions:
|
|
id-token: write # enable GitHub OIDC token issuance for this job
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
filter: tree:0
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: 8.x.x
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: ~/.nuget/packages
|
|
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-nuget-
|
|
|
|
- name: 🔫 Build and Pack
|
|
run: ./build.sh pack
|
|
|
|
- name: NuGet login (OIDC → temp API key)
|
|
uses: NuGet/login@v1
|
|
id: login
|
|
with:
|
|
user: ${{ secrets.NUGET_USER }}
|
|
|
|
- name: Push to nuget.org
|
|
run: dotnet nuget push output/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{steps.login.outputs.NUGET_API_KEY}}
|