Selective Nuget Package publish

This commit is contained in:
Trevor Payne
2022-07-20 16:42:25 -05:00
parent 24b02b199d
commit 0cf654ce2d
16 changed files with 382 additions and 433 deletions

View File

@@ -222,6 +222,7 @@ jobs:
Push_Nuget_Package:
needs: Build_Project
runs-on: windows-2019
env: NUSPECNAME
steps:
- name: Download Build Version Info
uses: actions/download-artifact@v1
@@ -250,22 +251,27 @@ jobs:
Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz")
Get-ChildItem -Path .\output\* | Copy-Item -Destination .\
Remove-Item -Path .\output -Recurse
#Pushes to github nuget store
- name: Get nuget File
shell: powershell
run: |
$nuspec_file = Get-ChildItem *.nuspec -recurse
echo "NUSPEC_FILE=$($nuspec_file.BaseName)"| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$NUSPECNAME = Get-ChildItem *.nuspec -recurse
echo "NUSPEC_FILE=$($NUSPECNAME.BaseName)"| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Add nuget.exe
uses: nuget/setup-nuget@v1
- name: Add Github Packages source
if: $NUSPECNAME != 'PDT.EssentialsPluginTemplate'
run: nuget sources add -name github -source https://nuget.pkg.github.com/pepperdash/index.json -username Pepperdash -password ${{ secrets.GITHUB_TOKEN }}
# Pushes to nuget, not needed unless publishing publicly
# Pushes to nuget gallery, not needed unless publishing publicly
- name: Add nuget.org API Key
if: github.repository_owner == 'PepperDash' && github.repository_visibility == 'public' && $NUSPECNAME != 'PDT.EssentialsPluginTemplate'
run: nuget setApiKey ${{ secrets.NUGET_API_KEY }}
- name: Create nuget package
if: github.repository_owner == 'PepperDash' && github.repository_visibility == 'public' && $NUSPECNAME != 'PDT.EssentialsPluginTemplate'
run: nuget pack "./${{ env.NUSPEC_FILE}}.nuspec" -version ${{ env.VERSION }}
- name: Publish nuget package to Github registry
if: github.repository_owner == 'PepperDash' && github.repository_visibility == 'public' && $NUSPECNAME != 'PDT.EssentialsPluginTemplate'
run: nuget push **/*.nupkg -source github
# Pushes to nuget, not needed unless publishing publicly >> this pushes package to nuget.org
- name: Publish nuget package to nuget.org
if: github.repository_owner == 'PepperDash' && github.repository_visibility == 'public' && $NUSPECNAME != 'PDT.EssentialsPluginTemplate'
run: nuget push **/*.nupkg -Source https://api.nuget.org/v3/index.json