Skip to content

Commit

Permalink
update nuget_publish.yml (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
YanZhiwei authored Oct 15, 2024
1 parent b007f84 commit 09e7446
Showing 1 changed file with 35 additions and 31 deletions.
66 changes: 35 additions & 31 deletions .github/workflows/nuget_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,44 @@ jobs:
- name: Pack with dotnet
run: dotnet pack D:/a/Mortise/Mortise/Mortise.sln -o D:/a/nugetpkgs -c Release --no-build
- name: Upload artifact
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: nugetpkgs
path: D:/a/nugetpkgs

release_nuget:
name: Release to Nuget
needs: build_artifact
runs-on: windows-latest

steps:
- name: Download build artifacts
uses: actions/download-artifact@v1
with:
name: nugetpkgs
- name: list nugetpkgs
run: ls nugetpkgs
- name: Release
run: |
$excludeFileName = @('Sample', 'CleanArchitecture', 'Tests')
$nugetFiles = Get-ChildItem -Path nugetpkgs -Recurse -Include *.nupkg
foreach ($file in $nugetFiles) {
$fileName = $file.FullName
$skipFile = $false
foreach ($excludeName in $excludeFileName) {
if ($fileName -like "*$excludeName*") {
$skipFile = $true
break
}
}
if ($skipFile) {
Write-Host "Skipping file: $fileName"
continue
}
Write-Host "Processing file: $($file.FullName)"
dotnet nuget push $file --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate --source https://api.nuget.org/v3/index.json
name: Release to Nuget
needs: build_artifact
runs-on: windows-latest

steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: nugetpkgs
path: ./nugetpkgs

- name: List nugetpkgs
run: dir ./nugetpkgs

- name: Release
run: |
$excludeFileName = @('Sample', 'CleanArchitecture', 'Tests')
$nugetFiles = Get-ChildItem -Path ./nugetpkgs -Recurse -Include *.nupkg
foreach ($file in $nugetFiles) {
$fileName = $file.FullName
$skipFile = $false
foreach ($excludeName in $excludeFileName) {
if ($fileName -like "*$excludeName*") {
$skipFile = $true
break
}
}
if ($skipFile) {
Write-Host "Skipping file: $fileName"
continue
}
Write-Host "Processing file: $($file.FullName)"
dotnet nuget push $file --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate --source https://api.nuget.org/v3/index.json
}
}

0 comments on commit 09e7446

Please sign in to comment.