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

View File

@@ -111,7 +111,7 @@ jobs:
$exclusions = "packages"
# Trying to get any .json schema files (not currently working)
# Gets any files with the listed extensions.
Get-ChildItem -recurse -Path "$($Env:GITHUB_WORKSPACE)" -include "*.clz", "*.cpz", "*.cplz", "*.nuspec" | ForEach-Object {
Get-ChildItem -recurse -Path "$($Env:GITHUB_WORKSPACE)" -include "*.clz", "*.cpz", "*.cplz", "*.nuspec", "*.md" | ForEach-Object {
$allowed = $true;
# Exclude any files in submodules
foreach ($exclude in $exclusions) {
@@ -170,6 +170,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
@@ -195,25 +196,31 @@ jobs:
Remove-Item -Path .\*.zip
- name: Copy Files to root & delete output directory
run: |
Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz")
Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz","*.md")
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