diff --git a/.github/scripts/ZipBuildOutput.ps1 b/.github/scripts/ZipBuildOutput.ps1 index 5ca867ef..bf3c9d94 100644 --- a/.github/scripts/ZipBuildOutput.ps1 +++ b/.github/scripts/ZipBuildOutput.ps1 @@ -10,7 +10,7 @@ Get-ChildItem ($destination) $exclusions = @(git submodule foreach --quiet 'echo $name') # 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", "*.dll" | ForEach-Object { +Get-ChildItem -recurse -Path "$($Env:GITHUB_WORKSPACE)" -include "*.clz", "*.cpz", "*.cplz", "*.dll", "*.nuspec" | ForEach-Object { $allowed = $true; # Exclude any files in submodules foreach ($exclude in $exclusions) { diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 315fbd67..2da6c9a7 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -107,6 +107,49 @@ jobs: asset_content_type: application/zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + Push_Nuget_Package: + needs: Build_Project + runs-on: windows-latest + steps: + - name: Download Build Version Info + uses: actions/download-artifact@v1 + with: + name: Version + - name: Set Version Number + shell: powershell + run: | + Get-ChildItem "./Version" + $version = Get-Content -Path ./Version/version.txt + Write-Host "Version: $version" + Write-Output "::set-env name=VERSION::$version" + Remove-Item -Path ./Version/version.txt + Remove-Item -Path ./Version + - name: Download Build output + uses: actions/download-artifact@v1 + with: + name: Build + path: ./ + - name: Unzip Build file + run: | + Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\ + Remove-Item -Path .\*.zip + - name: Copy Files to root & delete output directory + run: | + Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz") + Get-ChildItem -Path .\output\* | Copy-Item -Destination .\ + Remove-Item -Path .\output -Recurse + - name: Add nuget.exe + uses: nuget/setup-nuget@v1 + - name: Add Github Packages source + run: nuget sources add -name github -source https://nuget.pkg.github.com/pepperdash/index.json -username Pepperdash -password ${{ secrets.GITHUB_TOKEN }} + - name: Add nuget.org API Key + run: nuget setApiKey ${{ secrets.NUGET_API_KEY }} + - name: Create nuget package + run: nuget pack "./PepperDash_Essentials_Core.nuspec" -version ${{ env.VERSION }} + - name: Publish nuget package to Github registry + run: nuget push **/*.nupkg -source github + - name: Publish nuget package to nuget.org + run: nuget push **/*.nupkg -Source https://api.nuget.org/v3/index.json # This step always runs and pushes the build to the internal build rep Internal_Push_Output: needs: Build_Project diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7bbbd646..efc11298 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -85,6 +85,49 @@ jobs: asset_content_type: application/zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + Push_Nuget_Package: + needs: Build_Project + runs-on: windows-latest + steps: + - name: Download Build Version Info + uses: actions/download-artifact@v1 + with: + name: Version + - name: Set Version Number + shell: powershell + run: | + Get-ChildItem "./Version" + $version = Get-Content -Path ./Version/version.txt + Write-Host "Version: $version" + Write-Output "::set-env name=VERSION::$version" + Remove-Item -Path ./Version/version.txt + Remove-Item -Path ./Version + - name: Download Build output + uses: actions/download-artifact@v1 + with: + name: Build + path: ./ + - name: Unzip Build file + run: | + Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\ + Remove-Item -Path .\*.zip + - name: Copy Files to root & delete output directory + run: | + Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz") + Get-ChildItem -Path .\output\* | Copy-Item -Destination .\ + Remove-Item -Path .\output -Recurse + - name: Add nuget.exe + uses: nuget/setup-nuget@v1 + - name: Add Github Packages source + run: nuget sources add -name github -source https://nuget.pkg.github.com/pepperdash/index.json -username Pepperdash -password ${{ secrets.GITHUB_TOKEN }} + - name: Add nuget.org API Key + run: nuget setApiKey ${{ secrets.NUGET_API_KEY }} + - name: Create nuget package + run: nuget pack "./PepperDash_Essentials_Core.nuspec" -version ${{ env.VERSION }} + - name: Publish nuget package to Github registry + run: nuget push **/*.nupkg -source github + - name: Publish nuget package to nuget.org + run: nuget push **/*.nupkg -Source https://api.nuget.org/v3/index.json Internal_Push_Output: needs: Build_Project runs-on: windows-latest