-
Notifications
You must be signed in to change notification settings - Fork 103
151 lines (134 loc) · 6.25 KB
/
nuget.yml
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: NuGet
on:
push:
branches:
- 'master'
tags:
- 'v*'
pull_request:
branches:
- 'master'
schedule:
- cron: '0 0 * * 6'
workflow_dispatch:
jobs:
nuget-push:
runs-on: 'windows-2022'
env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
NUGET_PACKAGES: ${{ github.workspace }}/.github/nuget-packages
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Read version from ref
id: version
shell: pwsh
run: echo "version=$(./scripts/Get-Version.ps1 -RefName $env:GITHUB_REF)" >> $env:GITHUB_OUTPUT
- name: NuGet cache
uses: actions/cache@v3
with:
path: ${{ env.NUGET_PACKAGES }}
key: release.nuget.${{ hashFiles('**/*.csproj', '**/*.fsproj') }}
- name: Set up .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Prepare a NuGet package
run: dotnet pack XamlMath.All.sln --configuration Release -p:Version=${{ steps.version.outputs.version }}
- name: Read changelog
id: changelog
uses: ForNeVeR/ChangelogAutomation.action@v1
with:
output: ./release-notes.md
- name: 'Upload workflow artifacts'
uses: 'actions/upload-artifact@v3'
with:
name: 'XAML-Math v${{ steps.version.outputs.version }}'
path: |
./release-notes.md
./src/AvaloniaMath/bin/Release/AvaloniaMath.${{ steps.version.outputs.version }}.nupkg
./src/AvaloniaMath/bin/Release/AvaloniaMath.${{ steps.version.outputs.version }}.snupkg
./src/WpfMath/bin/Release/WpfMath.${{ steps.version.outputs.version }}.nupkg
./src/WpfMath/bin/Release/WpfMath.${{ steps.version.outputs.version }}.snupkg
./src/XamlMath.Shared/bin/Release/XamlMath.Shared.${{ steps.version.outputs.version }}.nupkg
./src/XamlMath.Shared/bin/Release/XamlMath.Shared.${{ steps.version.outputs.version }}.snupkg
- name: Create release
if: startsWith(github.ref, 'refs/tags/v')
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: XAML-Math v${{ steps.version.outputs.version }}
body_path: ./release-notes.md
- name: Upload Avalonia-Math .nupkg file
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_name: AvaloniaMath.${{ steps.version.outputs.version }}.nupkg
asset_path: ./src/AvaloniaMath/bin/Release/AvaloniaMath.${{ steps.version.outputs.version }}.nupkg
asset_content_type: application/zip
- name: Upload WPF-Math .nupkg file
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_name: WpfMath.${{ steps.version.outputs.version }}.nupkg
asset_path: ./src/WpfMath/bin/Release/WpfMath.${{ steps.version.outputs.version }}.nupkg
asset_content_type: application/zip
- name: Upload XAML-Math .nupkg file
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_name: XamlMath.Shared.${{ steps.version.outputs.version }}.nupkg
asset_path: ./src/XamlMath.Shared/bin/Release/XamlMath.Shared.${{ steps.version.outputs.version }}.nupkg
asset_content_type: application/zip
- name: Upload Avalonia-Math .snupkg file
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_name: AvaloniaMath.${{ steps.version.outputs.version }}.snupkg
asset_path: ./src/AvaloniaMath/bin/Release/AvaloniaMath.${{ steps.version.outputs.version }}.snupkg
asset_content_type: application/zip
- name: Upload WPF-Math .snupkg file
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_name: WpfMath.${{ steps.version.outputs.version }}.snupkg
asset_path: ./src/WpfMath/bin/Release/WpfMath.${{ steps.version.outputs.version }}.snupkg
asset_content_type: application/zip
- name: Upload XAML-Math .snupkg file
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_name: XamlMath.Shared.${{ steps.version.outputs.version }}.snupkg
asset_path: ./src/XamlMath.Shared/bin/Release/XamlMath.Shared.${{ steps.version.outputs.version }}.snupkg
asset_content_type: application/zip
- name: Push Avalonia-Math package to NuGet
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet nuget push ./src/AvaloniaMath/bin/Release/AvaloniaMath.${{ steps.version.outputs.version }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN_AVALONIA }}
- name: Push WPF-Math package to NuGet
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet nuget push ./src/WpfMath/bin/Release/WpfMath.${{ steps.version.outputs.version }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN_WPF }}
- name: Push XAML-Math package to NuGet
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet nuget push ./src/XamlMath.Shared/bin/Release/XamlMath.Shared.${{ steps.version.outputs.version }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN_XAML }}