Skip to content

Commit b64f988

Browse files
authored
Update Release workflow with the workaround from Test (#180)
* Update Release workflow with the workaround from Test * gpr failed when workflow rerun
1 parent 892eaec commit b64f988

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

.github/workflows/Release.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ jobs:
2121
2222
${{ github.event.release.body }}
2323
run: |
24+
# .NET Core MSBuild cannot parse , and ; correctly so we replace them with substitutions: https://github.com/dotnet/msbuild/issues/471#issuecomment-366268743
25+
# https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion
26+
# ${parameter/pattern/string} If pattern begins with ‘/’, all matches of pattern are replaced with string. Normally only the first match is replaced.
27+
RELEASE_NOTES=${RELEASE_NOTES//,/%2C}
28+
RELEASE_NOTES=${RELEASE_NOTES//;/%3B}
29+
2430
# -r for restore
2531
dotnet msbuild -r -p:Configuration=Release -p:PackageVersion="${{ github.event.release.tag_name }}" -p:PackageReleaseNotes="$RELEASE_NOTES" CSharpMath.CrossPlatform.slnf
2632
- name: Upload to GitHub Releases
@@ -34,4 +40,4 @@ jobs:
3440
- name: Upload to NuGet
3541
run: | # We use double quotes to avoid shell globbing: https://github.com/NuGet/Home/issues/4393#issuecomment-667618120
3642
# Use --skip-duplicate since we want re-runs of this workflow to succeed in case of network issues
37-
dotnet nuget push ".nupkgs/*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
43+
dotnet nuget push ".nupkgs/*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate

.github/workflows/Test.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ jobs:
3232
# ${{ steps.release_drafter.outputs.name }}
3333
3434
${{ steps.release_drafter.outputs.body }}
35-
# run: dotnet test
36-
run: | # https://github.com/dotnet/sdk/issues/10409, https://github.com/dotnet/sdk/issues/11417
35+
run: |
3736
# .NET Core MSBuild cannot parse , and ; correctly so we replace them with substitutions: https://github.com/dotnet/msbuild/issues/471#issuecomment-366268743
3837
# https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion
3938
# ${parameter/pattern/string} If pattern begins with ‘/’, all matches of pattern are replaced with string. Normally only the first match is replaced.
@@ -83,18 +82,11 @@ jobs:
8382
- name: Push CI artifacts to GitHub Packages registry
8483
if: github.ref == 'refs/heads/master'
8584
run: |
86-
# dotnet nuget push to GitHub Packages is unstable for project names with a dot: https://github.com/NuGet/Home/issues/9775
87-
# So someone wrote a .NET Core tool to workaround this: https://github.com/NuGet/Home/issues/9775#issuecomment-660947350
88-
# Currently this tool will never return a non-0 exit code: https://github.com/jcansdale/gpr/issues/69 (nice)
89-
# But we must not include .snupkg files in globbing or a duplicate version error will occur: https://github.com/jcansdale/gpr/issues/83
90-
dotnet tool install -g gpr
91-
gpr push .nupkgs/*.nupkg -k ${{ secrets.GITHUB_TOKEN }}
92-
93-
# Original code before using this tool:
94-
# # Non-Windows platforms require --store-password-in-clear-text: https://github.com/NuGet/Home/issues/1851
95-
# dotnet nuget add source https://nuget.pkg.github.com/verybadcat/index.json -n github -u verybadcat -p ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text
96-
# # We use double quotes to avoid shell globbing: https://github.com/NuGet/Home/issues/4393#issuecomment-667618120
97-
# dotnet nuget push ".nupkgs/*.nupkg" --source "github" --skip-duplicate --no-symbols # Don't let GitHub Releases interpret .snupkg as .nupkg
85+
# "dotnet nuget push" with "dotnet nuget add source" to GitHub Packages is unstable for project names with a dot: https://github.com/NuGet/Home/issues/9775#issuecomment-714509211
86+
# So we must specify api-key directly in "dotnet nuget push" instead of following the GitHub Packages documentation
87+
# We use quotes to avoid shell globbing: https://github.com/NuGet/Home/issues/4393#issuecomment-667618120
88+
# --no-symbols to not let GitHub Releases interpret .snupkg as .nupkg
89+
dotnet nuget push '.nupkgs/*.nupkg' --source 'https://nuget.pkg.github.com/verybadcat/index.json' --api-key ${{ github.token }} --skip-duplicate --no-symbols
9890
Ios:
9991
runs-on: macos-latest
10092
steps:

0 commit comments

Comments
 (0)