File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Release
2+
3+ on :
4+ push :
5+ tags :
6+ - " v*"
7+ workflow_dispatch :
8+ inputs :
9+ version :
10+ description : " Package version, for example 0.1.0"
11+ required : true
12+
13+ permissions :
14+ contents : read
15+ id-token : write
16+
17+ jobs :
18+ publish :
19+ runs-on : ubuntu-latest
20+ environment : nuget
21+
22+ steps :
23+ - name : Checkout
24+ uses : actions/checkout@v4
25+ with :
26+ fetch-depth : 0
27+
28+ - name : Setup .NET
29+ uses : actions/setup-dotnet@v4
30+ with :
31+ dotnet-version : 10.0.x
32+
33+ - name : Verify release comes from main
34+ shell : bash
35+ run : |
36+ git fetch origin main
37+ git merge-base --is-ancestor "$GITHUB_SHA" origin/main
38+
39+ - name : Resolve version
40+ id : version
41+ shell : bash
42+ run : |
43+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
44+ echo "value=${{ inputs.version }}" >> "$GITHUB_OUTPUT"
45+ else
46+ echo "value=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
47+ fi
48+
49+ - name : Restore
50+ run : dotnet restore Notion2Ical.sln
51+
52+ - name : Build
53+ run : dotnet build Notion2Ical.sln --configuration Release --no-restore
54+
55+ - name : Test
56+ run : dotnet test Notion2Ical.sln --configuration Release --no-build --verbosity normal
57+
58+ - name : Pack
59+ run : dotnet pack Notion2Ical/Notion2Ical.csproj --configuration Release --no-build --output artifacts /p:PackageVersion=${{ steps.version.outputs.value }}
60+
61+ - name : NuGet login
62+ uses : NuGet/login@v1
63+ id : login
64+ with :
65+ user : ${{ vars.NUGET_USER }}
66+
67+ - name : Push to NuGet
68+ run : dotnet nuget push artifacts/*.nupkg --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
You can’t perform that action at this time.
0 commit comments