204 lines (168 loc) · 6.76 KB
/
build.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: Build
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
release:
types: [ released ]
env:
DotNetVersion: "5.0.100"
BuildConfiguration: "Release"
BuildParameters: "build/Build.proj /v:Minimal /consoleLoggerParameters:NoSummary /p:Configuration=Release /p:BuildVersion=${{ github.run_id }} /p:BuildBranch=${{ github.ref }}"
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNetVersion }}
- name: Setup msbuild
uses: microsoft/setup-msbuild@v1
- name: Build
run: dotnet build ${{ env.BuildParameters }} /p:Platform=Windows /t:Package /bl:artifacts/log/Build.Windows.binlog
- name: Build VS/Win Extension
run: msbuild ${{ env.BuildParameters }} /t:BuildAddins /bl:artifacts/log/Addin.Windows.binlog
- name: Upload nuget artifacts
uses: actions/upload-artifact@v2
with:
name: nuget
path: artifacts/nuget/${{ env.BuildConfiguration }}/*.nupkg
- name: Upload extension artifacts
uses: actions/upload-artifact@v2
with:
name: addins
path: artifacts/addin/${{ env.BuildConfiguration }}/VisualStudio/Eto.Addin.VisualStudio*.vsix
- name: Upload test artifacts
uses: actions/upload-artifact@v2
with:
name: test
path: |
artifacts/test/${{ env.BuildConfiguration }}/**/*
!artifacts/test/${{ env.BuildConfiguration }}/**/*Mac64.*
- name: Upload sample artifacts
uses: actions/upload-artifact@v2
with:
name: samples
path: artifacts/samples/${{ env.BuildConfiguration }}/**/*
- name: Upload log files
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: log
path: artifacts/log/**/*
build-mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNetVersion }}
- name: Setup Xamarin and XCode
uses: maxim-lobanov/setup-xamarin@v1
with:
mono-version: latest
xamarin-mac-version: latest
xcode-version: latest
- name: Import code signing certificate
if: github.event_name != 'pull_request'
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.DEVID_CERTIFICATE_P12 }}
p12-password: ${{ secrets.DEVID_CERTIFICATE_P12_PASSWORD }}
- name: Enable code signing
if: github.event_name != 'pull_request'
run: echo "BuildParameters=${{ env.BuildParameters }} /p:EnableCodeSignBuild=True" >> $GITHUB_ENV
- name: Set notarization credentials
if: startsWith(github.ref, 'refs/tags/')
run: |
xcrun altool --store-password-in-keychain-item "AC_PASSWORD" -u "${{ secrets.AC_USERNAME }}" -p "${{ secrets.AC_PASSWORD }}"
echo "BuildParameters=${{ env.BuildParameters }} /p:EnableNotarizationBuild=True" >> $GITHUB_ENV
- name: Build
run: dotnet build ${{ env.BuildParameters }} /p:Platform=Mac /t:Package /bl:artifacts/log/Build.Mac.binlog
- name: Build VS/Mac extension
run: msbuild ${{ env.BuildParameters }} /t:BuildAddins /bl:artifacts/log/Addin.Mac.binlog
- name: Upload nuget artifacts
uses: actions/upload-artifact@v2
with:
name: nuget
path: |
artifacts/nuget/${{ env.BuildConfiguration }}/Eto.Platform.XamMac2*.nupkg
artifacts/nuget/${{ env.BuildConfiguration }}/Eto.Platform.Gtk2*.nupkg
- name: Upload extension artifacts
uses: actions/upload-artifact@v2
with:
name: addins
path: artifacts/addin/${{ env.BuildConfiguration }}/net472/Eto.Addin.MonoDevelop*.mpack
- name: Upload test artifacts
uses: actions/upload-artifact@v2
with:
name: test
path: |
artifacts/test/${{ env.BuildConfiguration }}/**/*XamMac2.*
artifacts/test/${{ env.BuildConfiguration }}/**/*Mac64.*
artifacts/test/${{ env.BuildConfiguration }}/**/*Gtk2.*
- name: Upload log files
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: log
path: |
artifacts/log/**/*
lib/monomac/artifacts/generated/**/*.binlog
update-release:
needs: [ build-windows, build-mac ]
runs-on: ubuntu-latest
if: (github.event_name == 'release' && github.event.action == 'published' && startsWith(github.ref, 'refs/tags/'))
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download extension artifacts
uses: actions/download-artifact@v2
with:
name: addins
- name: Upload VS/Win addin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: Eto.Addin.VisualStudio-${{ steps.get_version.outputs.VERSION }}.vsix
asset_name: Eto.Addin.VisualStudio-${{ steps.get_version.outputs.VERSION }}.vsix
asset_content_type: application/octet-stream
- name: Upload VS/Mac addin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: Eto.Addin.MonoDevelop-${{ steps.get_version.outputs.VERSION }}.mpack
asset_name: Eto.Addin.MonoDevelop-${{ steps.get_version.outputs.VERSION }}.mpack
asset_content_type: application/octet-stream
publish:
needs: [ build-windows, build-mac ]
runs-on: ubuntu-latest
if: (github.event_name == 'push' && github.ref == 'refs/heads/develop') || (github.event_name == 'release' && github.event.action == 'published' && startsWith(github.ref, 'refs/tags/'))
steps:
- name: Download nuget artifacts
uses: actions/download-artifact@v2
with:
name: nuget
- name: Push packages to myget.org
run: dotnet nuget push '*.nupkg' --skip-duplicate -s https://www.myget.org/F/eto/api/v2/package -k ${{secrets.MYGET_API_KEY}}
- name: Push packages to nuget.org
if: (github.event_name == 'release' && github.event.action == 'published' && startsWith(github.ref, 'refs/tags/'))
run: dotnet nuget push '*.nupkg' --skip-duplicate -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}