Skip to content

Commit dfe986d

Browse files
committed
add ios workflow
1 parent 948799d commit dfe986d

7 files changed

Lines changed: 269 additions & 2 deletions

File tree

.github/workflows/apple.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: ios-IJKMediaFramework
2+
3+
on:
4+
# push:
5+
# branches: [master]
6+
# pull_request:
7+
# branches: [master]
8+
workflow_dispatch:
9+
inputs:
10+
beta:
11+
type: boolean
12+
description: publish beta edition
13+
default: true
14+
required: false
15+
jobs:
16+
build:
17+
name: build-ios-ijk-framework
18+
runs-on: macos-14
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
with:
24+
submodules: recursive
25+
- name: Prepare Beta Version
26+
if: ${{ inputs.beta == true }}
27+
run: |
28+
grep -m 1 VERSION_NAME= version.sh | awk -F = '{printf "VERSION=%s",$2}' | xargs > constants.env
29+
echo "RELEAE_DATE=$(TZ=UTC-8 date +'%y%m%d%H%M%S')" >> constants.env
30+
echo "TAG=k"$(grep "VERSION" constants.env | cut -d'=' -f2)"-beta-"$(grep "RELEAE_DATE" constants.env | cut -d'=' -f2) >> constants.env
31+
cat constants.env
32+
- name: Prepare Normal Version
33+
if: ${{ inputs.beta == false }}
34+
run: |
35+
grep -m 1 VERSION_NAME= version.sh | awk -F = '{printf "TAG=k%s",$2}' | xargs > constants.env
36+
cat constants.env
37+
- name: Export Env
38+
uses: cardinalby/export-env-action@v2
39+
with:
40+
envFile: 'constants.env'
41+
- run: brew install tree
42+
- name: Download Pre Compiled Dependencies
43+
run: cd ios && ./install-ffmpeg.sh
44+
- name: Build iOS Framework
45+
run: cd ios && ./build-framework.sh
46+
- name: Make xcframework
47+
run: cd ios/xcframewrok && ./make-xcframework.sh
48+
- name: Make podspec
49+
run: cd ios/xcframewrok && ./make-podspec.sh "${{ env.TAG }}"
50+
- name: Make Distribution Resources
51+
run: |
52+
mkdir dist
53+
cp NEWS.md dist
54+
cp README.md dist
55+
cp COPYING.LGPLv3 dist/LICENSE
56+
cp -pPR ios/xcframewrok/IJKMediaFramework.xcframework dist
57+
cd dist
58+
zip -ryq IJKMediaFramework.zip ./*
59+
- name: Upload Release Asset
60+
env:
61+
GH_TOKEN: ${{ github.token }}
62+
run: |
63+
branch=$(git branch --show-current)
64+
gh release create ${{ env.TAG }} --target $branch -t "👏👏 IJKMediaFramework ${{ env.TAG }}" dist/IJKMediaFramework.zip ios/xcframewrok/IJKMediaFramework.spec.json

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ xcshareddata
4242
*.xccheckout
4343

4444
android/ijkplayer/ijkplayer-cmake/.cxx
45+
ios/IJKMediaPlayer/Release-iphoneos
46+
ios/IJKMediaPlayer/Release-iphonesimulator
47+
ios/xcframewrok/IJKMediaFramework.xcframework
48+
ios/xcframewrok/IJKMediaFramework.spec.json

ios/IJKMediaPlayer/IJKMediaPlayer.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@
12991299
GCC_WARN_UNINITIALIZED_AUTOS = YES;
13001300
GCC_WARN_UNUSED_FUNCTION = YES;
13011301
GCC_WARN_UNUSED_VARIABLE = YES;
1302-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
1302+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
13031303
ONLY_ACTIVE_ARCH = YES;
13041304
SDKROOT = iphoneos;
13051305
};
@@ -1345,7 +1345,7 @@
13451345
GCC_WARN_UNINITIALIZED_AUTOS = YES;
13461346
GCC_WARN_UNUSED_FUNCTION = YES;
13471347
GCC_WARN_UNUSED_VARIABLE = YES;
1348-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
1348+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
13491349
SDKROOT = iphoneos;
13501350
VALIDATE_PRODUCT = YES;
13511351
};

ios/build-framework.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2024 Matt Reach<qianlongxu@gmail.com>
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
18+
cd "$THIS_DIR"
19+
20+
set -e
21+
22+
# 1
23+
WORKSPACE_NAME="IJKMediaPlayer/IJKMediaPlayer.xcodeproj"
24+
TARGET_NAME="IJKMediaFramework"
25+
26+
WORK_DIR="IJKMediaPlayer/Release/Release-iphoneos"
27+
SIM_WORK_DIR="IJKMediaPlayer/Release/Release-iphonesimulator"
28+
29+
# 2
30+
if [ -d ${WORK_DIR} ]; then
31+
rm -rf ${WORK_DIR}
32+
fi
33+
34+
if [ -d ${SIM_WORK_DIR} ]; then
35+
rm -rf ${SIM_WORK_DIR}
36+
fi
37+
38+
# 3
39+
# project方式
40+
# xcodebuild -showsdks
41+
# Build the framework for device and simulator with all architectures.
42+
export IPHONEOS_DEPLOYMENT_TARGET=11.0
43+
44+
xcodebuild -project ${WORKSPACE_NAME} -scheme ${TARGET_NAME} \
45+
-configuration Release \
46+
-destination 'generic/platform=iOS' \
47+
-destination 'generic/platform=iOS Simulator' \
48+
BUILD_DIR=. \
49+
clean build
50+
51+
echo "ios framework dir:$WORK_DIR"
52+
echo "ios simulator framework dir: $SIM_WORK_DIR"

ios/xcframewrok/make-podspec.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2024 Matt Reach<qianlongxu@gmail.com>
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
18+
cd "$THIS_DIR"
19+
20+
set -e
21+
version=${1:-$(grep -m 1 VERSION_NAME= ../../version.sh | awk -F = '{printf "k%s",$2}')}
22+
23+
fn=IJKMediaFramework.spec.json
24+
cat 'template.spec.json' \
25+
| sed "s/__VERSION__/${version}/" \
26+
> "${fn}"
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2024 Matt Reach<qianlongxu@gmail.com>
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
18+
cd "$THIS_DIR"
19+
20+
set -e
21+
22+
function get_inputs_with_path()
23+
{
24+
fmwk="$1"
25+
inputs=""
26+
if [[ -d $fmwk ]]; then
27+
inputs="$inputs -framework $fmwk"
28+
fi
29+
fmwk_dsym="${fmwk}.dSYM"
30+
if [[ -d $fmwk_dsym ]]; then
31+
inputs="$inputs -debug-symbols $(cd $fmwk_dsym; DIRNAME=$(dirname pwd); cd "$DIRNAME"; pwd)"
32+
fi
33+
echo "$inputs"
34+
}
35+
36+
function get_inputs()
37+
{
38+
# add iOS
39+
ios_inputs=$(get_inputs_with_path '../IJKMediaPlayer/Release-iphoneos/IJKMediaFramework.framework')
40+
# add iOS Simulator
41+
ios_sim_inputs=$(get_inputs_with_path '../IJKMediaPlayer/Release-iphonesimulator/IJKMediaFramework.framework')
42+
43+
echo "${ios_inputs} ${ios_sim_inputs}"
44+
}
45+
46+
function do_make_xcframework() {
47+
inputs="$(get_inputs)"
48+
output=IJKMediaFramework.xcframework
49+
rm -rf "$output"
50+
echo "xcodebuild -create-xcframework $inputs -output $output"
51+
xcodebuild -create-xcframework $inputs -output $output
52+
}
53+
54+
do_make_xcframework

ios/xcframewrok/template.spec.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"name": "IJKMediaFramework",
3+
"version": "__VERSION__",
4+
"summary": "IJKMediaFramework is iOS platform ijkplayer framework.",
5+
"description": "IJKMediaFramework is iOS platform ijkplayer framework.",
6+
"homepage": "https://github.com/debugly/ijkplayer",
7+
"documentation_url": "https://github.com/debugly/ijkplayer",
8+
"social_media_url": "https://github.com/debugly/ijkplayer",
9+
"license": {
10+
"type": "LGPL",
11+
"file": "IJKMediaFramework/LICENSE"
12+
},
13+
"authors": {
14+
"MattReach": "qianlongxu@gmail.com"
15+
},
16+
"platforms": {
17+
"ios": "11.0",
18+
"osx": "10.11",
19+
"tvos": "12.0"
20+
},
21+
"source": {
22+
"http": "https://github.com/debugly/ijkplayer/releases/download/__VERSION__/IJKMediaFramework.zip"
23+
},
24+
"preserve_paths": [
25+
"IJKMediaFramework/README.md",
26+
"IJKMediaFramework/CHANGELOG.md",
27+
"IJKMediaFramework/LICENSE"
28+
],
29+
"vendored_frameworks": "IJKMediaFramework.xcframework",
30+
"libraries": [
31+
"z",
32+
"iconv",
33+
"xml2",
34+
"bz2",
35+
"c++",
36+
"lzma"
37+
],
38+
"frameworks": [
39+
"AVFoundation",
40+
"AudioToolbox",
41+
"CoreMedia",
42+
"CoreVideo",
43+
"VideoToolbox",
44+
"Metal"
45+
],
46+
"osx": {
47+
"frameworks": [
48+
"Cocoa",
49+
"AudioUnit",
50+
"OpenGL",
51+
"GLKit",
52+
"CoreImage"
53+
]
54+
},
55+
"tvos": {
56+
"frameworks": [
57+
"UIKit",
58+
"OpenGLES"
59+
]
60+
},
61+
"ios": {
62+
"frameworks": [
63+
"UIKit",
64+
"OpenGLES"
65+
]
66+
}
67+
}

0 commit comments

Comments
 (0)