Files
hiha-arvio/.github/workflows/publish.yml
Ismo Vuorinen 571b783054 fix: Update GitHub workflows to handle platform-specific builds correctly
Fix workflow issues preventing builds from running:

**Test Workflow (test.yml)**
- Change from solution restore to test project only
- Only restore/build HihaArvio.Tests.csproj (net8.0 target)
- Prevents iOS/macOS workload errors on Ubuntu runner
- Tests run on Ubuntu (fast, cheap, no platform dependencies)

**Build Workflow (build.yml)**
- Replace `dotnet workload install maui` with `dotnet workload restore`
- Use project-specific restore instead of solution restore
- Restore only HihaArvio.csproj for each platform job
- Add `--no-restore` flag to build commands
- More reliable workload installation

**Publish Workflow (publish.yml)**
- Replace `dotnet workload install maui` with `dotnet workload restore`
- Use project-specific restore instead of solution restore
- Add `--no-restore` flag to publish commands
- Consistent with build workflow pattern

**Why These Changes**:
1. Solution restore on Linux tries to restore iOS/macOS targets
2. This requires workloads that don't exist on Ubuntu
3. Error: "NETSDK1147: workloads must be installed: wasm-tools-net8"
4. Solution: Only restore what each platform needs
5. Test project (net8.0) works on any platform
6. MAUI projects (iOS/macOS) only on macOS runners

**Benefits**:
- Tests run successfully on Ubuntu
- Faster workload installation (restore vs install)
- More explicit about dependencies
- Avoids unnecessary multi-platform restore
- Cleaner build logs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 14:05:49 +02:00

207 lines
7.1 KiB
YAML

name: Publish
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g., 1.0.0)'
required: true
type: string
env:
DOTNET_VERSION: '8.0.x'
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version
id: get_version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
fi
- name: Generate changelog
id: changelog
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "changelog=Manual release of version ${{ steps.get_version.outputs.version }}" >> $GITHUB_OUTPUT
else
# Get commits since last tag
PREVIOUS_TAG=$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1) 2>/dev/null || echo "")
if [[ -z "$PREVIOUS_TAG" ]]; then
CHANGELOG=$(git log --pretty=format:"- %s (%h)" --no-merges)
else
CHANGELOG=$(git log ${PREVIOUS_TAG}..HEAD --pretty=format:"- %s (%h)" --no-merges)
fi
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
fi
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event_name == 'workflow_dispatch' && format('v{0}', github.event.inputs.version) || github.ref }}
release_name: Release ${{ steps.get_version.outputs.version }}
body: |
## HihaArvio v${{ steps.get_version.outputs.version }}
Sleeve Estimate - A playful Finnish take on agile estimation through shake gestures.
### Changes
${{ steps.changelog.outputs.changelog }}
### Supported Platforms
- iOS 15.0+
- macOS 12.0+ (via Mac Catalyst)
### Installation
- **iOS**: Download the `.ipa` file and install via Xcode or TestFlight
- **macOS**: Download the `.app` bundle and move to Applications folder
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
draft: false
prerelease: ${{ contains(steps.get_version.outputs.version, 'alpha') || contains(steps.get_version.outputs.version, 'beta') || contains(steps.get_version.outputs.version, 'rc') }}
build-and-publish-ios:
name: Build and Publish iOS
runs-on: macos-14
needs: create-release
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore workloads
run: dotnet workload restore src/HihaArvio/HihaArvio.csproj
- name: Restore dependencies
run: dotnet restore src/HihaArvio/HihaArvio.csproj
- name: Build iOS Release
run: |
dotnet publish src/HihaArvio/HihaArvio.csproj \
-f net8.0-ios \
-c Release \
--no-restore \
/p:ApplicationDisplayVersion=${{ needs.create-release.outputs.version }} \
/p:ApplicationVersion=${{ github.run_number }} \
/p:ArchiveOnBuild=false \
/p:EnableCodeSigning=false
- name: Create iOS artifact archive
run: |
cd src/HihaArvio/bin/Release/net8.0-ios
zip -r HihaArvio-iOS-${{ needs.create-release.outputs.version }}.zip *.app
mv HihaArvio-iOS-${{ needs.create-release.outputs.version }}.zip ${{ github.workspace }}/
- name: Upload iOS Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./HihaArvio-iOS-${{ needs.create-release.outputs.version }}.zip
asset_name: HihaArvio-iOS-${{ needs.create-release.outputs.version }}.zip
asset_content_type: application/zip
build-and-publish-maccatalyst:
name: Build and Publish macOS
runs-on: macos-14
needs: create-release
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore workloads
run: dotnet workload restore src/HihaArvio/HihaArvio.csproj
- name: Restore dependencies
run: dotnet restore src/HihaArvio/HihaArvio.csproj
- name: Build macOS Catalyst Release
run: |
dotnet publish src/HihaArvio/HihaArvio.csproj \
-f net8.0-maccatalyst \
-c Release \
--no-restore \
/p:ApplicationDisplayVersion=${{ needs.create-release.outputs.version }} \
/p:ApplicationVersion=${{ github.run_number }} \
/p:ArchiveOnBuild=false \
/p:EnableCodeSigning=false
- name: Create macOS artifact archive
run: |
cd src/HihaArvio/bin/Release/net8.0-maccatalyst
zip -r HihaArvio-macOS-${{ needs.create-release.outputs.version }}.zip *.app
mv HihaArvio-macOS-${{ needs.create-release.outputs.version }}.zip ${{ github.workspace }}/
- name: Upload macOS Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./HihaArvio-macOS-${{ needs.create-release.outputs.version }}.zip
asset_name: HihaArvio-macOS-${{ needs.create-release.outputs.version }}.zip
asset_content_type: application/zip
publish-status:
name: Publish Status
runs-on: ubuntu-latest
needs: [create-release, build-and-publish-ios, build-and-publish-maccatalyst]
if: always()
steps:
- name: Check publish status
run: |
echo "## Release Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Version: ${{ needs.create-release.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Build Status" >> $GITHUB_STEP_SUMMARY
echo "- iOS: ${{ needs.build-and-publish-ios.result }}" >> $GITHUB_STEP_SUMMARY
echo "- macOS Catalyst: ${{ needs.build-and-publish-maccatalyst.result }}" >> $GITHUB_STEP_SUMMARY
if [[ "${{ needs.build-and-publish-ios.result }}" == "success" ]] && [[ "${{ needs.build-and-publish-maccatalyst.result }}" == "success" ]]; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ All builds succeeded and artifacts published" >> $GITHUB_STEP_SUMMARY
exit 0
else
echo "" >> $GITHUB_STEP_SUMMARY
echo "❌ One or more builds failed" >> $GITHUB_STEP_SUMMARY
exit 1
fi