forked from verybadcat/CSharpMath
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (42 loc) · 1.97 KB
/
Release.yml
File metadata and controls
45 lines (42 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Release
on:
release:
types: [published]
jobs:
CSharpMath:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
with:
submodules: 'recursive'
- uses: actions/setup-dotnet@main
with:
dotnet-version: '10.x'
workloads: maui, wasm-tools
- name: Build GitHub Releases draft artifacts
env:
RELEASE_NOTES: |
${{ format('# {0}', github.event.release.name) }}
${{ github.event.release.body }}
run: |
# .NET Core MSBuild cannot parse , and ; correctly so we replace them with MSBuild XML escapes: https://github.com/dotnet/msbuild/issues/471#issuecomment-366268743
$env:RELEASE_NOTES = $env:RELEASE_NOTES -replace ',','%2C' -replace ';','%3B'
# For why Not.Uno.Example is used, see Nightly.yml
dotnet build -c Not.Uno.Example -p:PackageReleaseNotes="$env:RELEASE_NOTES" -p:PackageVersion="${{ github.event.release.tag_name }}"
shell: pwsh
- name: Upload to GitHub Releases
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ github.token }}
tag: ${{ github.ref }}
file: .nupkgs/*
file_glob: true
overwrite: true
- name: Upload to NuGet
run: |
# On Windows, / will not be interpreted as the folder separator in this command and \ must be used here, unlike in Unix environments.
# "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
# so we must specify -k (key) directly in "dotnet nuget push" instead of following the GitHub Packages documentation.
# --skip-duplicate enables re-running this workflow even if some packages from the same commit are already uploaded.
dotnet nuget push '.nupkgs\*.nupkg' -s 'https://api.nuget.org/v3/index.json' -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate
shell: pwsh