Skip to content

Commit 2753323

Browse files
authored
Merge pull request #258 from proyecto26/develop
fix(ci): NuGet CLI install and branch split fixes
2 parents f64f226 + e149fcf commit 2753323

1 file changed

Lines changed: 26 additions & 14 deletions

File tree

.github/workflows/release.yml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -232,24 +232,27 @@ jobs:
232232
- name: Pull latest (includes version bump commit)
233233
run: git pull origin master
234234

235-
# Use nuget CLI with .nuspec file (old-style .csproj is not compatible with dotnet pack)
235+
- name: Setup .NET
236+
uses: actions/setup-dotnet@v4
237+
with:
238+
dotnet-version: '8.0.x'
239+
236240
- name: Install NuGet CLI
237-
run: |
238-
sudo apt-get update && sudo apt-get install -y nuget
241+
run: dotnet tool install --global NuGet.CommandLine --version '*'
239242

240243
- name: Build NuGet package
241244
run: |
242245
cd src/Proyecto26.RestClient
243-
nuget pack Proyecto26.RestClient.nuspec -Version ${{ needs.release.outputs.new_version }} -OutputDirectory ../../artifacts
246+
~/.dotnet/tools/nuget pack Proyecto26.RestClient.nuspec \
247+
-Version ${{ needs.release.outputs.new_version }} \
248+
-OutputDirectory ../../artifacts
244249
245250
- name: Publish to NuGet
246251
run: |
247-
nuget push artifacts/*.nupkg \
252+
~/.dotnet/tools/nuget push artifacts/*.nupkg \
248253
-ApiKey ${{ secrets.NUGET_API_KEY }} \
249254
-Source https://api.nuget.org/v3/index.json \
250255
-SkipDuplicate
251-
env:
252-
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
253256
254257
split-branches:
255258
name: Split UPM & NuGet branches
@@ -311,16 +314,25 @@ jobs:
311314
PKG_ROOT: src/Proyecto26.RestClient
312315
UPM_ROOT: Release
313316

317+
# Fresh checkout needed because UPM split modified the working tree
318+
- name: Fresh checkout for NuGet split
319+
uses: actions/checkout@v4
320+
with:
321+
ref: master
322+
fetch-depth: 0
323+
clean: true
324+
325+
- name: Pull latest for NuGet
326+
run: git pull origin master
327+
314328
- name: Split NuGet branch
315329
run: |
316-
git checkout master
317-
git pull origin master
318330
git branch -d nuget &> /dev/null || echo "nuget branch not found"
319-
git mv LICENSE $NUGET_ROOT
320-
git mv README.md $NUGET_ROOT
321-
git mv SECURITY.md $NUGET_ROOT
322-
git mv CHANGELOG.md $NUGET_ROOT
323-
git mv CONTRIBUTING.md $NUGET_ROOT
331+
git mv LICENSE $NUGET_ROOT 2>/dev/null || true
332+
git mv README.md $NUGET_ROOT 2>/dev/null || true
333+
git mv SECURITY.md $NUGET_ROOT 2>/dev/null || true
334+
git mv CHANGELOG.md $NUGET_ROOT 2>/dev/null || true
335+
git mv CONTRIBUTING.md $NUGET_ROOT 2>/dev/null || true
324336
git config --global user.name 'github-actions[bot]'
325337
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
326338
git subtree split -P "$NUGET_ROOT" -b nuget

0 commit comments

Comments
 (0)