mirror of
https://github.com/ivuorinen/hiha-arvio.git
synced 2026-01-26 11:24:04 +00:00
Add -f parameter to dotnet restore commands to ensure assets are generated for the specific target framework being built. **Problem**: - dotnet restore without -f flag restores all target frameworks - But assets file (project.assets.json) might not include runtime identifiers - Build fails with: "Assets file doesn't have a target for 'net8.0-maccatalyst/maccatalyst-x64'" - Error NETSDK1047 when using --no-restore flag **Solution**: Explicitly restore for each target framework before building: - iOS job: dotnet restore -f net8.0-ios - macOS job: dotnet restore -f net8.0-maccatalyst This ensures the assets file includes the correct runtime identifiers (iossimulator-arm64, maccatalyst-x64, etc.) needed for the build. **Changes**: - build.yml: Add -f to restore for iOS and macOS jobs - publish.yml: Add -f to restore for iOS and macOS jobs - Updated step names for clarity **Why This Works**: The -f flag tells restore to generate assets for that specific TFM and its associated RuntimeIdentifiers, which the build step requires. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
91 lines
2.5 KiB
YAML
91 lines
2.5 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop ]
|
|
pull_request:
|
|
branches: [ main, develop ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-ios:
|
|
name: Build iOS
|
|
runs-on: macos-14
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: '8.0.x'
|
|
|
|
- name: Restore workloads
|
|
run: dotnet workload restore src/HihaArvio/HihaArvio.csproj
|
|
|
|
- name: Restore dependencies for iOS
|
|
run: dotnet restore src/HihaArvio/HihaArvio.csproj -f net8.0-ios
|
|
|
|
- name: Build iOS
|
|
run: dotnet build src/HihaArvio/HihaArvio.csproj -f net8.0-ios -c Release --no-restore /p:ArchiveOnBuild=false /p:EnableCodeSigning=false
|
|
|
|
- name: Upload iOS build artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ios-build
|
|
path: |
|
|
src/HihaArvio/bin/Release/net8.0-ios/**/*.app
|
|
src/HihaArvio/bin/Release/net8.0-ios/**/*.ipa
|
|
retention-days: 7
|
|
|
|
build-maccatalyst:
|
|
name: Build macOS Catalyst
|
|
runs-on: macos-14
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: '8.0.x'
|
|
|
|
- name: Restore workloads
|
|
run: dotnet workload restore src/HihaArvio/HihaArvio.csproj
|
|
|
|
- name: Restore dependencies for macOS Catalyst
|
|
run: dotnet restore src/HihaArvio/HihaArvio.csproj -f net8.0-maccatalyst
|
|
|
|
- name: Build macOS Catalyst
|
|
run: dotnet build src/HihaArvio/HihaArvio.csproj -f net8.0-maccatalyst -c Release --no-restore /p:ArchiveOnBuild=false /p:EnableCodeSigning=false
|
|
|
|
- name: Upload macOS build artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: maccatalyst-build
|
|
path: |
|
|
src/HihaArvio/bin/Release/net8.0-maccatalyst/**/*.app
|
|
src/HihaArvio/bin/Release/net8.0-maccatalyst/**/*.pkg
|
|
retention-days: 7
|
|
|
|
build-status:
|
|
name: Build Status
|
|
runs-on: ubuntu-latest
|
|
needs: [build-ios, build-maccatalyst]
|
|
if: always()
|
|
|
|
steps:
|
|
- name: Check build status
|
|
run: |
|
|
if [[ "${{ needs.build-ios.result }}" == "success" ]] && [[ "${{ needs.build-maccatalyst.result }}" == "success" ]]; then
|
|
echo "✅ All builds succeeded"
|
|
exit 0
|
|
else
|
|
echo "❌ One or more builds failed"
|
|
echo "iOS: ${{ needs.build-ios.result }}"
|
|
echo "macOS Catalyst: ${{ needs.build-maccatalyst.result }}"
|
|
exit 1
|
|
fi
|