Files
plist-cil/.github/workflows/ci.yaml
Frederik Carlier 0d30b8f444 Add NerdBank.GitVersioning support
This commit adds [NerdBank.GitVersioning](https://www.nuget.org/packages/Nerdbank.GitVersioning), which gives every build of plist-cil a unique version number.

The base version number is stored in `version.json` (e.g. 2.2) and is incremented by 1 every time a commit is added.  Builds off branches contain a `+g{commit}` suffix, indicating that these builds are prerelease.

This makes it easier to keep track of different versions of plist-cil.
2025-01-08 21:09:37 +01:00

39 lines
1.2 KiB
YAML

name: .NET
on:
push:
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Build
run: dotnet build -c Release
- name: Test
run: dotnet test
- name: Create NuGet packages
run: |
dotnet pack -c Release -o nuget/
- name: Get version information
uses: dotnet/nbgv@master
id: nbgv
- name: Publish NuGet packages as artifacts
uses: actions/upload-artifact@v3
with:
name: plist-cil-${{ steps.nbgv.outputs.SemVer2 }}
path: nuget/
- name: Publish NuGet packages to NuGet feed
run: |
dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
dotnet nuget push "nuget/*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --source "github"
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}