-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (32 loc) · 1.17 KB
/
build-and-publish-nuget.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
32
33
34
35
36
37
38
39
40
41
42
43
name: Build and publish NuGet
on:
push:
branches:
- main
permissions:
contents: read
id-token: write
packages: write
env:
VERSIONNUMBER: 1.0.0
jobs:
Build-and-publish:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Add Vipps NuGet Source
run: dotnet nuget update source GitHub_Nuget --store-password-in-clear-text -u USERNAME -p ${{ secrets.GITHUB_TOKEN }}
- name: Generate build number
id: buildnumber
run: echo "BUILDNUMBER=$((($(date +%s) - $(date -d '2024-01-01' +%s)) / 3600 % 65535))" >> $GITHUB_ENV
- name: Locate Project File
id: locate_csproj
run: echo "CS_PROJ_PATH=$(find . -name '*.csproj' | head -n 1)" >> $GITHUB_ENV
- name: Pack
run: dotnet pack "${{ env.CS_PROJ_PATH }}" --configuration Release /p:Version=${{ env.VERSIONNUMBER }}.${{ env.BUILDNUMBER }}
- name: Push
run: dotnet nuget push ./**/*.nupkg --skip-duplicate --source https://nuget.pkg.github.com/vippsas/index.json --api-key ${{ secrets.GITHUB_TOKEN }}