-
Notifications
You must be signed in to change notification settings - Fork 1
31 lines (30 loc) · 1.2 KB
/
publish-goodrouter-net.yml
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
on:
push:
tags:
- goodrouter-net@*.*.*
jobs:
publish-nuget:
runs-on: ubuntu-latest
container: mcr.microsoft.com/dotnet/sdk:6.0
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
# from https://semver.org/
SEMVER_REGEX: >
^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
steps:
- run: apt update
- run: apt install git-lfs
- uses: actions/checkout@v3
with:
lfs: true
# see https://learn.microsoft.com/en-us/dotnet/standard/library-guidance/versioning
- run: >
dotnet pack Goodrouter
--configuration Release
--property Version=${GITHUB_REF_NAME:15}
--property AssemblyVersion=$(echo ${GITHUB_REF_NAME:15} | perl -pe "s/${SEMVER_REGEX}/\1.0.0.0/")
--property FileVersion=$(echo ${GITHUB_REF_NAME:15} | perl -pe "s/${SEMVER_REGEX}/\1.\2.\3.${GITHUB_RUN_ID}/")
- run: >
dotnet nuget push
--api-key $NUGET_API_KEY
--source https://api.nuget.org/v3/index.json '${GITHUB_REF_NAME:14}/Goodrouter/bin/Release/*.nupkg'