Skip to content

Commit 949ed1f

Browse files
committed
ci: update the workflows
1 parent a25254a commit 949ed1f

File tree

16 files changed

+648
-508
lines changed

16 files changed

+648
-508
lines changed
File renamed without changes.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build XCFramework
2+
description: Build XCFramework for iOS and iOS Simulator
3+
4+
inputs:
5+
project_name:
6+
description: Name of the Xcode project or scheme
7+
required: true
8+
9+
outputs:
10+
xcframework_path:
11+
description: Final path to the generated XCFramework
12+
value: ${{ steps.build.outputs.xcframework_path }}
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: Build XCFramework
18+
id: build
19+
shell: bash
20+
run: |
21+
set -euo pipefail
22+
23+
PROJECT_NAME="${{ inputs.project_name }}"
24+
BUILD_DIR="./build"
25+
26+
echo "🛠️ Building XCFramework..."
27+
28+
xcodebuild archive \
29+
-scheme "$PROJECT_NAME" \
30+
-configuration Release \
31+
-destination 'generic/platform=iOS Simulator' \
32+
-archivePath "$BUILD_DIR/${PROJECT_NAME}.framework-iphonesimulator.xcarchive" \
33+
SKIP_INSTALL=NO \
34+
BUILD_LIBRARIES_FOR_DISTRIBUTION=YES | xcbeautify
35+
36+
xcodebuild archive \
37+
-scheme "$PROJECT_NAME" \
38+
-configuration Release \
39+
-destination 'generic/platform=iOS' \
40+
-archivePath "$BUILD_DIR/${PROJECT_NAME}.framework-iphoneos.xcarchive" \
41+
SKIP_INSTALL=NO \
42+
BUILD_LIBRARIES_FOR_DISTRIBUTION=YES | xcbeautify
43+
44+
XCFRAMEWORK_PATH="$BUILD_DIR/${PROJECT_NAME}.xcframework"
45+
46+
xcodebuild -create-xcframework \
47+
-framework "$BUILD_DIR/${PROJECT_NAME}.framework-iphonesimulator.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \
48+
-framework "$BUILD_DIR/${PROJECT_NAME}.framework-iphoneos.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \
49+
-output "$XCFRAMEWORK_PATH"
50+
51+
echo "✅ XCFramework built successfully"
52+
echo "xcframework_path=$XCFRAMEWORK_PATH" >> "$GITHUB_OUTPUT"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Get Project Version
2+
description: Extracts MARKETING_VERSION from a .pbxproj file
3+
4+
inputs:
5+
project_name:
6+
description: Name of the Xcode project (without .xcodeproj)
7+
required: false
8+
pbxproj_path:
9+
description: Path to the project.pbxproj file (overrides project_name if provided)
10+
required: false
11+
12+
outputs:
13+
version:
14+
description: The extracted project version
15+
value: ${{ steps.extract.outputs.version }}
16+
17+
runs:
18+
using: "composite"
19+
steps:
20+
- name: Extract current project version
21+
id: extract
22+
shell: bash
23+
run: |
24+
set -euo pipefail
25+
26+
# Determine the pbxproj path
27+
if [[ -n "${{ inputs.pbxproj_path }}" ]]; then
28+
PBXPROJ="${{ inputs.pbxproj_path }}"
29+
elif [[ -n "${{ inputs.project_name }}" ]]; then
30+
PBXPROJ="${{ inputs.project_name }}.xcodeproj/project.pbxproj"
31+
else
32+
echo "❌ Either 'project_name' or 'pbxproj_path' must be provided."
33+
exit 1
34+
fi
35+
36+
# Check if the pbxproj file exists
37+
if [[ ! -f "$PBXPROJ" ]]; then
38+
echo "❌ Project file not found: $PBXPROJ"
39+
exit 1
40+
fi
41+
42+
echo "📦 Extracting current MARKETING_VERSION from $PBXPROJ..."
43+
VERSION=$(grep -m1 'MARKETING_VERSION =' "$PBXPROJ" | sed -E 's/.*MARKETING_VERSION = ([^;]+);/\1/' | xargs)
44+
echo "🔢 Current version: $VERSION"
45+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Install Dependencies
2+
description: Checks for Homebrew and installs any missing CLI tools and Ruby gems
3+
4+
inputs:
5+
tools:
6+
description: Space-separated list of tools to check and install via Homebrew
7+
required: false
8+
gems:
9+
description: Space-separated list of gems to check and install via gem
10+
required: false
11+
12+
runs:
13+
using: "composite"
14+
steps:
15+
- name: Install Dependencies
16+
shell: bash
17+
run: |
18+
set -euo pipefail
19+
20+
if [ -n "${{ inputs.tools }}" ]; then
21+
echo "🔍 Checking for Homebrew..."
22+
if ! command -v brew >/dev/null; then
23+
echo "❌ Homebrew is required but not installed. Aborting."
24+
exit 1
25+
fi
26+
27+
echo "🔧 Installing missing brew tools..."
28+
for tool in ${{ inputs.tools }}; do
29+
if command -v "$tool" >/dev/null; then
30+
echo "✅ $tool is already installed."
31+
else
32+
echo "📦 Installing $tool via brew..."
33+
brew install "$tool"
34+
fi
35+
done
36+
fi
37+
38+
if [ -n "${{ inputs.gems }}" ]; then
39+
echo "🔧 Installing missing gems..."
40+
for gem in ${{ inputs.gems }}; do
41+
if gem list -i "$gem" >/dev/null; then
42+
echo "✅ $gem gem is already installed."
43+
else
44+
echo "💎 Installing $gem via gem..."
45+
gem install "$gem"
46+
fi
47+
done
48+
fi
49+
50+
echo "✅ All dependencies are ready."
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Package XCFramework and LICENSE
2+
description: Zips the built XCFramework and LICENSE into a versioned release artifact
3+
4+
inputs:
5+
package_name:
6+
description: The name of the package (e.g., MyLibrary-1.0.0)
7+
required: true
8+
xcframework_path:
9+
description: The path to the built .xcframework
10+
required: true
11+
license_path:
12+
description: The path to the LICENSE file
13+
required: true
14+
15+
outputs:
16+
zip_name:
17+
description: The name of the created zip file
18+
value: ${{ steps.package.outputs.zip_name }}
19+
20+
runs:
21+
using: "composite"
22+
steps:
23+
- id: package
24+
shell: bash
25+
run: |
26+
set -euo pipefail
27+
ZIP_NAME="${{ inputs.package_name }}.zip"
28+
mkdir -p release
29+
cp -R "${{ inputs.xcframework_path }}" release/
30+
cp "${{ inputs.license_path }}" release/
31+
cd release
32+
zip -r "../$ZIP_NAME" .
33+
echo "✅ Packaged XCFramework and LICENSE into $ZIP_NAME"
34+
echo "zip_name=$ZIP_NAME" >> "$GITHUB_OUTPUT"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Set Xcode Version
2+
description: Selects the desired Xcode version using xcode-select.
3+
inputs:
4+
xcode-version:
5+
description: The Xcode version to select (e.g., 16.4)
6+
required: true
7+
runs:
8+
using: 'composite'
9+
steps:
10+
- run: |
11+
set -e
12+
echo "Setting Xcode version to ${{ inputs.xcode-version }}..."
13+
if ! sudo xcode-select -s /Applications/Xcode_${{ inputs.xcode-version }}.app/Contents/Developer; then
14+
echo "❌ Failed to select Xcode ${{ inputs.xcode-version }}. Listing available Xcodes:"
15+
ls /Applications | grep Xcode
16+
exit 1
17+
fi
18+
shell: bash

pull_request_template.md renamed to .github/pull_request_template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- [ ] Fix (non-breaking change which fixes an issue)
1111
- [ ] Feature (non-breaking change which adds functionality)
1212
- [ ] Refactor (cosmetic changes)
13-
- [ ] Breaking change (change that would cause existing functionality not to work as expected)
13+
- [ ] Breaking change (change that would cause existing functionality to not work as expected)
1414

1515
## Tests
1616
<!--- Describe how you tested your changes in detail -->
@@ -21,7 +21,7 @@
2121
## Checklist
2222
<!--- Go over all the following items and put an `x` in all the boxes that apply -->
2323
- [ ] Pull request title follows the format `RNMT-XXXX <title>`
24-
- [ ] Code follows the code style of this project
24+
- [ ] Code follows code style of this project
2525
- [ ] CHANGELOG.md file is correctly updated
2626
- [ ] Changes require an update to the documentation
2727
- [ ] Documentation has been updated accordingly

0 commit comments

Comments
 (0)