Merge pull request #2705 from clicketyclackety/patch-1 #1304
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [ develop ] | |
pull_request: | |
branches: [ develop ] | |
release: | |
types: [ published ] | |
env: | |
DotNetVersion: "8.0.106" | |
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@v4 | |
with: | |
submodules: true | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DotNetVersion }} | |
- name: Create global.json | |
run: echo '{"sdk":{"version":"${{ env.DotNetVersion }}"}}' > global.json | |
- 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@v4 | |
with: | |
name: nuget-win | |
path: artifacts/nuget/${{ env.BuildConfiguration }}/*.nupkg | |
- name: Upload test artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-win | |
path: | | |
artifacts/test/*/${{ env.BuildConfiguration }}/**/* | |
!artifacts/test/Eto.Test.Mac64/**/* | |
- name: Upload sample artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: samples-win | |
path: artifacts/samples/*/${{ env.BuildConfiguration }}/**/* | |
- name: Upload log files | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: log-win | |
path: artifacts/log/**/* | |
build-mac: | |
runs-on: macos-14 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DotNetVersion }} | |
- name: Create global.json | |
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 XCode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- 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 notarytool store-credentials "AC_PASSWORD" --apple-id "${{ secrets.AC_USERNAME }}" --team-id "${{ secrets.AC_TEAMID }}" --password "${{ 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@v4 | |
with: | |
name: nuget-mac | |
path: | | |
artifacts/nuget/${{ env.BuildConfiguration }}/Eto.Platform.macOS*.nupkg | |
- name: Upload test artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-mac | |
path: | | |
artifacts/test/Eto.Test.Mac64/${{ env.BuildConfiguration }}/**/Eto.Test.Mac64.dmg | |
artifacts/test/Eto.Test.macOS/${{ env.BuildConfiguration }}/*/Eto.Test.macOS.app | |
- name: Upload log files | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: log-mac | |
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@v4 | |
with: | |
pattern: nuget-* | |
merge-multiple: true | |
- 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@v2 | |
if: (github.event_name == 'release' && github.event.action == 'published' && startsWith(github.ref, 'refs/tags/')) | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: '*.nupkg' |