Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update nuget_publish.yml #29

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}
Loading