Files
hiha-arvio/.github/workflows/publish.yml
Ismo Vuorinen 78b0b325a5 ci: Add GitHub workflows for test, build, and publish
Add comprehensive CI/CD workflows:

**Test Workflow (test.yml)**
- Runs on push/PR to main/develop
- Executes all 189 xUnit tests on Ubuntu runner
- Publishes test results and artifacts
- Fast and cost-effective validation

**Build Workflow (build.yml)**
- Builds for iOS and macOS Catalyst
- Runs on macOS-14 runners (Apple Silicon)
- Parallel builds for all platforms
- Uploads build artifacts (7-day retention)
- Overall build status reporting

**Publish Workflow (publish.yml)**
- Triggered by version tags (v*.*.*)
- Creates GitHub releases with changelogs
- Builds signed releases for distribution
- Uploads iOS and macOS .zip artifacts
- Supports pre-release detection (alpha/beta/rc)
- Manual workflow dispatch option

Features:
- .NET 8.0 with MAUI workload
- Parallel job execution for performance
- Artifact management and retention
- Test result reporting
- Release automation with version tracking
- Comprehensive documentation in workflows/README.md

Platforms supported:
- iOS 15.0+ (iossimulator-arm64)
- macOS 12.0+ Catalyst (maccatalyst-arm64)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 13:51:07 +02:00

205 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: Install MAUI workload
run: dotnet workload install maui --source https://api.nuget.org/v3/index.json
- name: Restore dependencies
run: dotnet restore HihaArvio.sln
- name: Build iOS Release
run: |
dotnet publish src/HihaArvio/HihaArvio.csproj \
-f net8.0-ios \
-c Release \
/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: Install MAUI workload
run: dotnet workload install maui --source https://api.nuget.org/v3/index.json
- name: Restore dependencies
run: dotnet restore HihaArvio.sln
- name: Build macOS Catalyst Release
run: |
dotnet publish src/HihaArvio/HihaArvio.csproj \
-f net8.0-maccatalyst \
-c Release \
/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