-
-
Notifications
You must be signed in to change notification settings - Fork 335
155 lines (126 loc) · 4.91 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
name: Build
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
release:
types: [ published ]
env:
DotNetVersion: "7.0.108"
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-2022
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DotNetVersion }}
- name: Setup msbuild
uses: microsoft/setup-msbuild@v1
- name: Build
run: dotnet build ${{ env.BuildParameters }} /p:Platform=Windows /t:Build /bl:artifacts/log/Build.Windows.binlog
- name: Upload nuget artifacts
uses: actions/upload-artifact@v2
with:
name: nuget
path: artifacts/nuget/${{ env.BuildConfiguration }}/*.nupkg
- name: Upload test artifacts
uses: actions/upload-artifact@v2
with:
name: test
path: |
artifacts/test/*/${{ env.BuildConfiguration }}/**/*
!artifacts/test/Eto.Test.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-11
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DotNetVersion }}
- name: Create global.json for the version we are using
run: del global.json || echo '{"sdk":{"version":"${{ env.DotNetVersion }}"}}' > global.json
- name: Install macos workload
run: sudo dotnet workload install macos --from-rollback-file dotnet-workloads.json
- 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:Build /bl:artifacts/log/Build.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.macOS*.nupkg
- name: Upload test artifacts
uses: actions/upload-artifact@v2
with:
name: test
path: |
artifacts/test/Eto.Test.Mac64/${{ env.BuildConfiguration }}/**/Eto.Test.Mac64.dmg
artifacts/test/Eto.Test.XamMac2/${{ env.BuildConfiguration }}/**/Eto.Test.XamMac2.app
artifacts/test/Eto.Test.macOS/${{ env.BuildConfiguration }}/*/Eto.Test.macOS.app
- name: Upload log files
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: log
path: |
artifacts/log/**/*
lib/monomac/artifacts/generated/**/*.binlog
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: Add nuget packages to release
uses: softprops/action-gh-release@v1
if: (github.event_name == 'release' && github.event.action == 'published' && startsWith(github.ref, 'refs/tags/'))
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: '*.nupkg'