Skip to content

Commit 8df0a29

Browse files
authored
Merge pull request #14 from SillyLittleTech/copilot/fix-copilot-review-issues
Fix CI workflow issues flagged in Copilot review of PR #12
2 parents c3467e8 + b5f63e0 commit 8df0a29

4 files changed

Lines changed: 303 additions & 23 deletions

File tree

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
name: Build & Release iOS and macOS Extensions
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '**.swift'
9+
- 'ios/**'
10+
- 'mos/**'
11+
- '.github/workflows/build-and-release.yml'
12+
workflow_dispatch:
13+
inputs:
14+
draft:
15+
description: 'Create as draft (for testing)'
16+
required: true
17+
default: 'true'
18+
type: choice
19+
options:
20+
- 'true'
21+
- 'false'
22+
23+
jobs:
24+
check-version:
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: read
28+
outputs:
29+
version: ${{ steps.extract.outputs.version }}
30+
tag_exists: ${{ steps.check_tag.outputs.exists }}
31+
steps:
32+
- uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0
35+
fetch-tags: true
36+
37+
- name: Extract version from Xcode project
38+
id: extract
39+
run: |
40+
VERSION=$(grep -m1 'MARKETING_VERSION = ' ios/Flean.xcodeproj/project.pbxproj | awk -F ' = ' '{ gsub(/;/,"",$2); print $2; exit }')
41+
echo "version=v$VERSION" >> $GITHUB_OUTPUT
42+
echo "Detected version: v$VERSION"
43+
44+
- name: Check if tag exists
45+
id: check_tag
46+
run: |
47+
if git ls-remote --tags --exit-code origin "refs/tags/${{ steps.extract.outputs.version }}" >/dev/null 2>&1; then
48+
echo "exists=true" >> $GITHUB_OUTPUT
49+
echo "Tag already exists!"
50+
else
51+
echo "exists=false" >> $GITHUB_OUTPUT
52+
echo "Tag does not exist - ready to build"
53+
fi
54+
55+
build-and-release:
56+
needs: check-version
57+
if: needs.check-version.outputs.tag_exists == 'false'
58+
runs-on: macos-latest
59+
permissions:
60+
contents: write
61+
62+
steps:
63+
- uses: actions/checkout@v4
64+
65+
# iOS Build
66+
- name: Build iOS App
67+
run: |
68+
cd ios
69+
mkdir -p build
70+
71+
xcodebuild build \
72+
-project Flean.xcodeproj \
73+
-target Flean \
74+
-configuration Release \
75+
-destination 'generic/platform=iOS' \
76+
-skipPackagePluginValidation \
77+
SYMROOT=build \
78+
CODE_SIGN_IDENTITY="" \
79+
CODE_SIGNING_REQUIRED=NO \
80+
CODE_SIGN_ENTITLEMENTS=""
81+
82+
# Package the .app as a proper IPA (Payload/Flean.app zipped)
83+
APP_PATH=$(find build -name "Flean.app" -type d | head -1)
84+
if [ -z "$APP_PATH" ]; then
85+
echo "❌ Flean.app not found"
86+
exit 1
87+
fi
88+
mkdir -p build/ipa/Payload
89+
cp -r "$APP_PATH" build/ipa/Payload/
90+
( cd build/ipa && zip -r ../Flean.ipa Payload )
91+
echo "✅ iOS build succeeded"
92+
93+
# macOS Build
94+
- name: Build macOS App
95+
run: |
96+
cd mos
97+
mkdir -p build
98+
99+
xcodebuild build \
100+
-project Flean.xcodeproj \
101+
-target Flean \
102+
-configuration Release \
103+
-skipPackagePluginValidation \
104+
SYMROOT=build \
105+
CODE_SIGN_IDENTITY="" \
106+
CODE_SIGNING_REQUIRED=NO \
107+
CODE_SIGN_ENTITLEMENTS=""
108+
109+
# Find and zip the .app into a fixed location matching the upload step
110+
APP_PATH=$(find build -name "Flean.app" -type d | head -1)
111+
if [ -z "$APP_PATH" ]; then
112+
echo "❌ Flean.app not found"
113+
exit 1
114+
fi
115+
116+
# Create a zip whose top-level entry is Flean.app
117+
OUT_ZIP="$(pwd)/build/Flean.app.zip"
118+
APP_DIR="$(dirname "$APP_PATH")"
119+
APP_NAME="$(basename "$APP_PATH")"
120+
( cd "$APP_DIR" && zip -r "$OUT_ZIP" "$APP_NAME" )
121+
echo "✅ macOS build succeeded"
122+
123+
# Create tag
124+
- name: Create Git Tag
125+
run: |
126+
git config user.name "github-actions"
127+
git config user.email "github-actions@github.com"
128+
VERSION="${{ needs.check-version.outputs.version }}"
129+
# Create local tag (no-op if already exists locally from a shallow clone)
130+
git tag "$VERSION" 2>/dev/null || echo "Local tag $VERSION already exists, proceeding with push"
131+
# Push to remote; fail clearly if the tag was created by a concurrent run
132+
if ! git push origin "$VERSION"; then
133+
echo "::error::Tag $VERSION already exists on remote. A release for this version may already exist."
134+
exit 1
135+
fi
136+
137+
# Create Release
138+
- name: Create Release
139+
uses: actions/create-release@v1
140+
id: create_release
141+
env:
142+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
143+
with:
144+
tag_name: ${{ needs.check-version.outputs.version }}
145+
release_name: "Flean ${{ needs.check-version.outputs.version }}"
146+
draft: ${{ github.event.inputs.draft == 'true' }}
147+
prerelease: false
148+
149+
# Upload iOS App
150+
- name: Upload iOS App
151+
uses: actions/upload-release-asset@v1
152+
env:
153+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
154+
with:
155+
upload_url: ${{ steps.create_release.outputs.upload_url }}
156+
asset_path: ./ios/build/Flean.ipa
157+
asset_name: Flean.ipa
158+
asset_content_type: application/octet-stream
159+
160+
# Upload macOS App
161+
- name: Upload macOS App
162+
uses: actions/upload-release-asset@v1
163+
env:
164+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165+
with:
166+
upload_url: ${{ steps.create_release.outputs.upload_url }}
167+
asset_path: ./mos/build/Flean.app.zip
168+
asset_name: Flean.app.zip
169+
asset_content_type: application/zip

.github/workflows/prerelease.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Create Prerelease on PR Ready
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types:
8+
- ready_for_review
9+
paths:
10+
- '.github/workflows/**'
11+
- '**.swift'
12+
- 'ios/**'
13+
- 'mos/**'
14+
15+
jobs:
16+
create-prerelease:
17+
runs-on: macos-latest
18+
permissions:
19+
contents: write
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Extract version from Xcode project
26+
id: extract
27+
run: |
28+
VERSION=$(grep -m1 'MARKETING_VERSION = ' ios/Flean.xcodeproj/project.pbxproj | awk -F ' = ' '{ gsub(/;/,"",$2); print $2; exit }')
29+
echo "version=v$VERSION" >> $GITHUB_OUTPUT
30+
echo "Detected version: v$VERSION"
31+
32+
- name: Build iOS
33+
run: |
34+
cd ios
35+
mkdir -p build
36+
37+
xcodebuild build \
38+
-project Flean.xcodeproj \
39+
-target Flean \
40+
-configuration Release \
41+
-destination 'generic/platform=iOS' \
42+
-skipPackagePluginValidation \
43+
SYMROOT=build \
44+
CODE_SIGN_IDENTITY="" \
45+
CODE_SIGNING_REQUIRED=NO \
46+
CODE_SIGN_ENTITLEMENTS=""
47+
48+
# Package the .app as a proper IPA (Payload/Flean.app zipped)
49+
APP_PATH=$(find build -name "Flean.app" -type d | head -1)
50+
if [ -z "$APP_PATH" ]; then
51+
echo "❌ Flean.app not found"
52+
exit 1
53+
fi
54+
mkdir -p build/ipa/Payload
55+
cp -r "$APP_PATH" build/ipa/Payload/
56+
( cd build/ipa && zip -r ../Flean.ipa Payload )
57+
echo "✅ iOS build succeeded"
58+
59+
- name: Build macOS
60+
run: |
61+
cd mos
62+
mkdir -p build
63+
64+
xcodebuild build \
65+
-project Flean.xcodeproj \
66+
-target Flean \
67+
-configuration Release \
68+
-skipPackagePluginValidation \
69+
SYMROOT=build \
70+
CODE_SIGN_IDENTITY="" \
71+
CODE_SIGNING_REQUIRED=NO \
72+
CODE_SIGN_ENTITLEMENTS=""
73+
74+
# Find and zip the .app
75+
APP_PATH=$(find build -name "Flean.app" -type d | head -1)
76+
if [ -z "$APP_PATH" ]; then
77+
echo "❌ Flean.app not found"
78+
exit 1
79+
fi
80+
OUT_ZIP="$(pwd)/build/Flean.app.zip"
81+
APP_DIR="$(dirname "$APP_PATH")"
82+
APP_NAME="$(basename "$APP_PATH")"
83+
( cd "$APP_DIR" && zip -r "$OUT_ZIP" "$APP_NAME" )
84+
echo "✅ macOS build succeeded"
85+
86+
- name: Create Prerelease
87+
uses: actions/create-release@v1
88+
id: create_prerelease
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
with:
92+
tag_name: ${{ steps.extract.outputs.version }}-prerelease-${{ github.run_number }}
93+
release_name: "Flean ${{ steps.extract.outputs.version }} - Prerelease (PR #${{ github.event.pull_request.number }})"
94+
body: |
95+
🧪 **Prerelease Build** from PR #${{ github.event.pull_request.number }}
96+
97+
**Branch:** ${{ github.event.pull_request.head.ref }}
98+
**Author:** @${{ github.event.pull_request.user.login }}
99+
100+
This is a prerelease. Testing and feedback welcome!
101+
draft: false
102+
prerelease: true
103+
104+
- name: Upload iOS App
105+
uses: actions/upload-release-asset@v1
106+
env:
107+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
with:
109+
upload_url: ${{ steps.create_prerelease.outputs.upload_url }}
110+
asset_path: ./ios/build/Flean.ipa
111+
asset_name: Flean.ipa
112+
asset_content_type: application/octet-stream
113+
114+
- name: Upload macOS App
115+
uses: actions/upload-release-asset@v1
116+
env:
117+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118+
with:
119+
upload_url: ${{ steps.create_prerelease.outputs.upload_url }}
120+
asset_path: ./mos/build/Flean.app.zip
121+
asset_name: Flean.app.zip
122+
asset_content_type: application/zip

ios/Flean.xcodeproj/project.pbxproj

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -576,20 +576,17 @@
576576
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
577577
CODE_SIGN_ENTITLEMENTS = Flean/Flean.entitlements;
578578
CODE_SIGN_STYLE = Automatic;
579-
COMBINE_HIDPI_IMAGES = YES;
580579
CURRENT_PROJECT_VERSION = 2;
581580
DEVELOPMENT_TEAM = PWL627GZ4Y;
582-
ENABLE_HARDENED_RUNTIME = YES;
583581
GENERATE_INFOPLIST_FILE = YES;
584582
INFOPLIST_KEY_CFBundleDisplayName = Flean;
585583
INFOPLIST_KEY_NSHumanReadableCopyright = "";
586-
INFOPLIST_KEY_NSMainStoryboardFile = Main;
587-
INFOPLIST_KEY_NSPrincipalClass = NSApplication;
584+
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
585+
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
588586
LD_RUNPATH_SEARCH_PATHS = (
589587
"$(inherited)",
590-
"@executable_path/../Frameworks",
588+
"@executable_path/Frameworks",
591589
);
592-
MACOSX_DEPLOYMENT_TARGET = 10.14;
593590
MARKETING_VERSION = 2.1.3;
594591
OTHER_LDFLAGS = (
595592
"-framework",
@@ -599,7 +596,7 @@
599596
);
600597
PRODUCT_BUNDLE_IDENTIFIER = slf.Flean;
601598
PRODUCT_NAME = "$(TARGET_NAME)";
602-
REGISTER_APP_GROUPS = YES;
599+
SDKROOT = iphoneos;
603600
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
604601
SUPPORTS_MACCATALYST = NO;
605602
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -615,20 +612,17 @@
615612
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
616613
CODE_SIGN_ENTITLEMENTS = Flean/Flean.entitlements;
617614
CODE_SIGN_STYLE = Automatic;
618-
COMBINE_HIDPI_IMAGES = YES;
619615
CURRENT_PROJECT_VERSION = 2;
620616
DEVELOPMENT_TEAM = PWL627GZ4Y;
621-
ENABLE_HARDENED_RUNTIME = YES;
622617
GENERATE_INFOPLIST_FILE = YES;
623618
INFOPLIST_KEY_CFBundleDisplayName = Flean;
624619
INFOPLIST_KEY_NSHumanReadableCopyright = "";
625-
INFOPLIST_KEY_NSMainStoryboardFile = Main;
626-
INFOPLIST_KEY_NSPrincipalClass = NSApplication;
620+
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
621+
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
627622
LD_RUNPATH_SEARCH_PATHS = (
628623
"$(inherited)",
629-
"@executable_path/../Frameworks",
624+
"@executable_path/Frameworks",
630625
);
631-
MACOSX_DEPLOYMENT_TARGET = 10.14;
632626
MARKETING_VERSION = 2.1.3;
633627
OTHER_LDFLAGS = (
634628
"-framework",
@@ -638,7 +632,7 @@
638632
);
639633
PRODUCT_BUNDLE_IDENTIFIER = slf.Flean;
640634
PRODUCT_NAME = "$(TARGET_NAME)";
641-
REGISTER_APP_GROUPS = YES;
635+
SDKROOT = iphoneos;
642636
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
643637
SUPPORTS_MACCATALYST = NO;
644638
SWIFT_EMIT_LOC_STRINGS = YES;

ios/Flean/iOS/FleanApp.swift

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
// iOS-only app entry. Guard so the file can live in the repo without
2-
// conflicting with the macOS `@main` app in `Flean/AppDelegate.swift`.
3-
#if os(iOS)
41
import SwiftUI
52
import WebKit
63

74
@main
85
struct FleanApp: App {
9-
var body: some Scene {
10-
WindowGroup {
11-
WebViewContainer()
12-
}
6+
var body: some Scene {
7+
WindowGroup {
8+
WebViewContainer()
139
}
10+
}
1411
}
15-
16-
#endif

0 commit comments

Comments
 (0)