56 lines
1.8 KiB
YAML
56 lines
1.8 KiB
YAML
name: LANCommander SDK Release
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
prep:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version_tag: ${{ steps.trim_tag_ref.outputs.replaced }}
|
|
version_semver: ${{ steps.extract_semver.outputs.replaced }}
|
|
steps:
|
|
- uses: frabert/replace-string-action@v2
|
|
name: Trim Tag Ref
|
|
id: trim_tag_ref
|
|
with:
|
|
string: '${{ github.ref }}'
|
|
pattern: 'refs/tags/v'
|
|
replace-with: ''
|
|
|
|
- uses: frabert/replace-string-action@v2
|
|
name: Extract SemVer (strip prerelease suffix for AssemblyVersion)
|
|
id: extract_semver
|
|
with:
|
|
string: '${{ steps.trim_tag_ref.outputs.replaced }}'
|
|
pattern: '-.*$'
|
|
replace-with: ''
|
|
|
|
publish:
|
|
needs: prep
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v3
|
|
with:
|
|
dotnet-version: '9.0.102'
|
|
|
|
- name: Restore dependencies
|
|
run: dotnet restore LANCommander.SDK/LANCommander.SDK.csproj
|
|
|
|
- name: Build project
|
|
run: dotnet build --configuration Release LANCommander.SDK/LANCommander.SDK.csproj -p:Version="${{ needs.prep.outputs.version_tag }}" -p:AssemblyVersion="${{ needs.prep.outputs.version_semver }}"
|
|
|
|
- name: Pack NuGet package with symbols
|
|
run: dotnet pack LANCommander.SDK/LANCommander.SDK.csproj --no-build --configuration Release -p:PackageVersion=${{ needs.prep.outputs.version_tag }} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -o ./artifacts
|
|
|
|
- name: Publish NuGet package
|
|
run: |
|
|
dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
|