Files
hiha-arvio/.github/workflows/publish.yml
Ismo Vuorinen b3d45526e0 fix: Use correct MSBuild property syntax for target framework in restore
Change from -f flag to /p:TargetFramework MSBuild property in
dotnet restore commands.

**Problem**:
- dotnet restore doesn't support -f or --framework flag
- Using -f causes error: "MSB1008: Only one project can be specified"
- MSBuild interprets "net8.0-maccatalyst" as a second project path

**Solution**:
Use MSBuild property syntax instead:
- Before: dotnet restore src/HihaArvio/HihaArvio.csproj -f net8.0-ios
- After: dotnet restore src/HihaArvio/HihaArvio.csproj /p:TargetFramework=net8.0-ios

**Why This Works**:
The /p:TargetFramework property tells restore to generate assets
specifically for that target framework and its runtime identifiers.

**Changes**:
- build.yml: Use /p:TargetFramework for iOS and macOS restores
- publish.yml: Use /p:TargetFramework for iOS and macOS restores

**Verified Locally**:
 dotnet restore /p:TargetFramework=net8.0-maccatalyst - Success

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

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

207 lines
7.2 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 for iOS
run: dotnet restore src/HihaArvio/HihaArvio.csproj /p:TargetFramework=net8.0-ios
- 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 for macOS Catalyst
run: dotnet restore src/HihaArvio/HihaArvio.csproj /p:TargetFramework=net8.0-maccatalyst
- 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