Skip to content

Merge pull request #27 from vippsas/UF-2022-Add-Basic-Acceptance-Tests #6

Merge pull request #27 from vippsas/UF-2022-Add-Basic-Acceptance-Tests

Merge pull request #27 from vippsas/UF-2022-Add-Basic-Acceptance-Tests #6

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 }}