Publish Nuget Package #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Nuget Package | |
on: | |
workflow_run: | |
workflows: ["CI"] | |
branches: [ main ] | |
types: | |
- completed | |
workflow_dispatch: | |
jobs: | |
publish-nuget: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .Net Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Get Version | |
id: package_version | |
uses: KageKirin/[email protected] | |
with: | |
file: Csp/Csp.csproj | |
- name: Install Dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
- name: Package | |
run: dotnet pack Csp/Csp.csproj --no-build --configuration Release --include-symbols -p:SymbolPackageFormat=snupkg -o . | |
- name: Publish to GitHub | |
run: dotnet nuget push *.nupkg --api-key ${{secrets.PKG_GITHUB_TOKEN}} --source "https://nuget.pkg.github.com/lifebeyondfife/index.json" --skip-duplicate | |
- name: Publish to Nuget | |
run: dotnet nuget push *.nupkg --api-key ${{secrets.NUGET_TOKEN}} --source "https://api.nuget.org/v3/index.json" --skip-duplicate | |
- name: Create Tag | |
run: | | |
git tag v${{steps.package_version.outputs.version}} | |
git push origin v${{steps.package_version.outputs.version}} |