Repository navigation
61 lines (47 loc) · 1.65 KB
/
Copy pathci.yml
File metadata and controls
61 lines (47 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: CI
on:
push:
tags:
- "v*.*.*"
pull_request:
branches: [ "main", "master" ]
workflow_dispatch:
jobs:
build-and-test:
if: github.event_name == 'pull_request' || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.0.x"
- name: Restore dependencies
run: dotnet restore SlugSharp.sln
- name: Build
run: dotnet build SlugSharp.sln --configuration Release --no-restore
- name: Test
run: dotnet test SlugSharp.sln --configuration Release --no-build --verbosity normal
publish-nuget:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: build-and-test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.0.x"
- name: Compute package version from tag
id: version
run: echo "value=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Restore package project
run: dotnet restore SlugSharp.Core/SlugSharp.Core.csproj
- name: Pack SlugText-Sharp
run: dotnet pack SlugSharp.Core/SlugSharp.Core.csproj --configuration Release --no-restore -o nupkgs /p:PackageVersion=${{ steps.version.outputs.value }}
- name: Push to NuGet
run: dotnet nuget push "nupkgs/*.nupkg" --api-key "${{ secrets.NUGET_API_KEY }}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate