Files
2026-11-16 21:23:09 +01:00

71 lines
1.7 KiB
YAML

name: CI
on:
push:
paths:
- '.github/workflows/ci.yml'
- 'src/**/**'
- 'build.cake'
pull_request:
paths:
- '.github/workflows/ci.yml'
- 'src/**/**'
- 'build.cake'
permissions:
# Needed to get an OIDC token for NuGet Trusted Publishing
id-token: write
# Needed to create a Github release
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- uses: actions/cache@v6
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.x
- name: Run the Cake script
uses: cake-build/cake-action@v3
with:
verbosity: Diagnostic
cake-version: 7.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: softprops/action-gh-release@v3
if: github.ref_type == 'tag'
with:
draft: true
files: |
./build/*.zip
./build/*.tar.gz
./build/*.nupkg
./build/*.snupkg
# Use NuGet trusted publishing: https://learn.microsoft.com/en-us/nuget/nuget-org/trusted-publishing
- name: NuGet login
uses: NuGet/login@v1
id: login
if: github.ref_type == 'tag'
with:
user: "${{ secrets.NUGET_USER }}"
- name: Push NuGet package
if: github.ref_type == 'tag'
run: |
dotnet nuget push ./build/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ steps.login.outputs.NUGET_API_KEY }}