Skip to content

Commit 399964b

Browse files
Copilotkiyarose
andauthored
Sync build-and-release.yml with prerelease.yml and add duplicate-tag handling
Agent-Logs-Url: https://github.com/SillyLittleTech/Flean/sessions/0d9831c6-41ea-44f5-b116-a54ae0e79047 Co-authored-by: kiyarose <75678535+kiyarose@users.noreply.github.com>
1 parent 7133f17 commit 399964b

1 file changed

Lines changed: 24 additions & 45 deletions

File tree

.github/workflows/build-and-release.yml

Lines changed: 24 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -63,51 +63,31 @@ jobs:
6363
- uses: actions/checkout@v4
6464

6565
# iOS Build
66-
- name: Build iOS IPA
66+
- name: Build iOS App
6767
run: |
6868
cd ios
6969
mkdir -p build
7070
71-
# Build archive
7271
xcodebuild archive \
7372
-project Flean.xcodeproj \
7473
-target Flean \
75-
-archivePath build/Flean.xcarchive \
7674
-configuration Release \
75+
-archivePath build/Flean.xcarchive \
7776
-destination 'generic/platform=iOS' \
7877
-skipPackagePluginValidation \
7978
CODE_SIGN_IDENTITY="" \
8079
CODE_SIGNING_REQUIRED=NO \
81-
CODE_SIGN_ENTITLEMENTS="" 2>&1 | tee build.log
80+
CODE_SIGN_ENTITLEMENTS=""
8281
83-
# Check for build errors
84-
if grep -i "error:" build.log; then
85-
echo "❌ iOS build failed"
82+
# Zip the .app from inside the xcarchive for distribution
83+
APP_PATH=$(find build/Flean.xcarchive/Products -name "Flean.app" -type d | head -1)
84+
if [ -z "$APP_PATH" ]; then
85+
echo "❌ Flean.app not found in xcarchive"
8686
exit 1
8787
fi
88-
89-
# Export IPA from archive
90-
cat > build/ExportOptions.plist << 'EOF'
91-
<?xml version="1.0" encoding="UTF-8"?>
92-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
93-
<plist version="1.0">
94-
<dict>
95-
<key>method</key>
96-
<string>development</string>
97-
<key>signingStyle</key>
98-
<string>automatic</string>
99-
</dict>
100-
</plist>
101-
EOF
102-
103-
xcodebuild -exportArchive \
104-
-archivePath build/Flean.xcarchive \
105-
-exportPath build/export \
106-
-exportOptionsPlist build/ExportOptions.plist \
107-
CODE_SIGN_IDENTITY="" \
108-
CODE_SIGNING_REQUIRED=NO \
109-
CODE_SIGN_ENTITLEMENTS="" 2>&1 | tee export.log
110-
88+
APP_DIR="$(dirname "$APP_PATH")"
89+
OUT_ZIP="$(pwd)/build/Flean-iOS.app.zip"
90+
( cd "$APP_DIR" && zip -r "$OUT_ZIP" "Flean.app" )
11191
echo "✅ iOS build succeeded"
11292
11393
# macOS Build
@@ -116,7 +96,6 @@ jobs:
11696
cd mos
11797
mkdir -p build
11898
119-
# Build directly to app
12099
xcodebuild build \
121100
-project Flean.xcodeproj \
122101
-target Flean \
@@ -125,13 +104,7 @@ jobs:
125104
SYMROOT=build \
126105
CODE_SIGN_IDENTITY="" \
127106
CODE_SIGNING_REQUIRED=NO \
128-
CODE_SIGN_ENTITLEMENTS="" 2>&1 | tee build.log
129-
130-
# Check for build errors
131-
if grep -i "error:" build.log; then
132-
echo "❌ macOS build failed"
133-
exit 1
134-
fi
107+
CODE_SIGN_ENTITLEMENTS=""
135108
136109
# Find and zip the .app into a fixed location matching the upload step
137110
APP_PATH=$(find build -name "Flean.app" -type d | head -1)
@@ -152,8 +125,14 @@ jobs:
152125
run: |
153126
git config user.name "github-actions"
154127
git config user.email "github-actions@github.com"
155-
git tag ${{ needs.check-version.outputs.version }}
156-
git push origin ${{ needs.check-version.outputs.version }}
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
157136
158137
# Create Release
159138
- name: Create Release
@@ -167,16 +146,16 @@ jobs:
167146
draft: ${{ github.event.inputs.draft == 'true' }}
168147
prerelease: false
169148

170-
# Upload iOS IPA
171-
- name: Upload iOS IPA
149+
# Upload iOS App
150+
- name: Upload iOS App
172151
uses: actions/upload-release-asset@v1
173152
env:
174153
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
175154
with:
176155
upload_url: ${{ steps.create_release.outputs.upload_url }}
177-
asset_path: ./ios/build/export/Flean.ipa
178-
asset_name: Flean.ipa
179-
asset_content_type: application/octet-stream
156+
asset_path: ./ios/build/Flean-iOS.app.zip
157+
asset_name: Flean-iOS.app.zip
158+
asset_content_type: application/zip
180159

181160
# Upload macOS App
182161
- name: Upload macOS App

0 commit comments

Comments
 (0)