Skip to content

update package metadata #14

update package metadata

update package metadata #14

Workflow file for this run

name: Package nuget
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
RESULT_DIR: result
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
source-url: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Restore dotnet tools
run: dotnet tool restore
- name: Build package
run: |
$packageOutputPath = Join-Path -Path $(pwd) -ChildPath ${{ env.RESULT_DIR }}
New-Item -Path $packageOutputPath -ItemType Directory -Force
msbuild -t:Restore -p:Configuration=Release
./pack.ps1 -PackageOutputPath $packageOutputPath
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: packages
path: ${{ env.RESULT_DIR }}
publish_to_github:
runs-on: ubuntu-latest
needs: [ build ]
environment: nuget
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: packages
path: ${{ env.RESULT_DIR }}
- name: Publish to github
run: |
dotnet nuget push "${{ env.RESULT_DIR }}/*.nupkg" \
--source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
--no-symbols \
--skip-duplicate \
--api-key ${GITHUB_TOKEN}
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
publish_to_nuget:
runs-on: ubuntu-latest
needs: [ build ]
environment: nuget
if: github.base_ref == '' # this would be set only on pull_request builds
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: packages
path: ${{ env.RESULT_DIR }}
- name: Publish to nuget.org
run: |
dotnet nuget push "${{ env.RESULT_DIR }}/*.nupkg" \
--source "nuget.org" \
--skip-duplicate \
--api-key ${NUGET_TOKEN}
env:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}