1
- name : Build XCFramework
1
+ name : Build and Release XCFramework
2
2
3
3
on :
4
4
push :
10
10
workflow_dispatch :
11
11
inputs :
12
12
release_version :
13
- description : ' Release version (e.g., 0 .1.6)'
13
+ description : ' Release version (must start with "v", e.g., v0 .1.6)'
14
14
required : false
15
15
default : ' '
16
16
17
+ env :
18
+ OUTPUT_DIR : ${{ github.workspace }}/output
19
+
17
20
jobs :
18
21
build :
19
22
runs-on : macos-latest
20
-
21
- env :
22
- OUTPUT_DIR : ${{ github.workspace }}/output
23
+ strategy :
24
+ matrix :
25
+ config :
26
+ - { sdk: 'macosx', arch: 'arm64', platform: 'MacOSX' }
27
+ - { sdk: 'macosx', arch: 'x86_64', platform: 'MacOSX' }
28
+ - { sdk: 'iphoneos', arch: 'arm64', platform: 'iPhoneOS' }
29
+ - { sdk: 'iphonesimulator', arch: 'x86_64', platform: 'iPhoneSimulator' }
30
+ - { sdk: 'iphonesimulator', arch: 'arm64', platform: 'iPhoneSimulator' }
23
31
24
32
steps :
25
- - uses : actions/checkout@v2
33
+ - uses : actions/checkout@v3
26
34
27
35
- name : Set up Xcode
28
36
uses : maxim-lobanov/setup-xcode@v1
29
37
with :
30
38
xcode-version : latest-stable
31
39
32
40
- name : Install autotools
33
- run : |
34
- brew install autoconf automake libtool
41
+ run : brew install autoconf automake libtool
35
42
36
43
- name : Setup build environment
37
44
run : |
38
45
aclocal && autoconf && automake --add-missing
39
46
mkdir -p "$OUTPUT_DIR"
40
47
41
- - name : Build for macOS arm64
42
- run : |
43
- ./.github/actions/build_library.sh macosx arm64 MacOSX
44
-
45
- - name : Build for macOS x86_64
48
+ - name : Build for ${{ matrix.config.sdk }} ${{ matrix.config.arch }}
46
49
run : |
47
- ./.github/actions/build_library.sh macosx x86_64 MacOSX
50
+ ./.github/actions/build_library.sh ${{ matrix.config.sdk }} ${{ matrix.config.arch }} ${{ matrix.config.platform }}
48
51
49
- - name : Build for iOS arm64
50
- run : |
51
- ./.github/actions/build_library.sh iphoneos arm64 iPhoneOS
52
+ - name : Upload build artifact
53
+ uses : actions/upload-artifact@v4
54
+ with :
55
+ name : build-${{ matrix.config.sdk }}-${{ matrix.config.arch }}
56
+ path : ${{ env.OUTPUT_DIR }}
57
+ retention-days : 1
52
58
53
- - name : Build for iOS Simulator x86_64
54
- run : |
55
- ./.github/actions/build_library.sh iphonesimulator x86_64 iPhoneSimulator
59
+ create-xcframework :
60
+ needs : build
61
+ runs-on : macos-latest
62
+ steps :
63
+ - uses : actions/checkout@v3
56
64
57
- - name : Build for iOS Simulator arm64
58
- run : |
59
- ./.github/actions/build_library.sh iphonesimulator arm64 iPhoneSimulator
65
+ - name : Download all build artifacts
66
+ uses : actions/download-artifact@v4
67
+ with :
68
+ path : ${{ env.OUTPUT_DIR }}
60
69
61
70
- name : Create XCFrameworks
62
71
run : |
72
81
cp -a amrwb/{dec_if,if_rom}.h ${OUTPUT_DIR}/Headers/
73
82
./.github/actions/create_xcframework.sh opencore-amrwb
74
83
75
- - name : Determine Release Version
76
- id : version
77
- run : |
78
- if [[ $GITHUB_REF == refs/tags/* ]]; then
79
- echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
80
- elif [ -n "${{ github.event.inputs.release_version }}" ]; then
81
- echo "version=${{ github.event.inputs.release_version }}" >> $GITHUB_OUTPUT
82
- else
83
- echo "version=v${{ github.run_number }}" >> $GITHUB_OUTPUT
84
- fi
85
-
86
- - name : List output directory
87
- run : |
88
- echo "Current working directory: $(pwd)"
89
- echo "OUTPUT_DIR: ${{ env.OUTPUT_DIR }}"
90
- echo "Contents of OUTPUT_DIR:"
91
- ls -la ${{ env.OUTPUT_DIR }}
92
- echo "Full paths of .xcframework directories:"
93
- find ${{ env.OUTPUT_DIR }} -name "*.xcframework" -type d
94
- echo "Structure of .xcframework directories:"
95
- find ${{ env.OUTPUT_DIR }} -name "*.xcframework" -type d -exec sh -c 'echo "{}:"; ls -R "{}"' \;
96
-
97
84
- name : Zip XCFrameworks
98
85
run : |
99
86
cd ${{ env.OUTPUT_DIR }}
@@ -102,9 +89,38 @@ jobs:
102
89
done
103
90
ls -la
104
91
92
+ - name : Upload XCFrameworks
93
+ uses : actions/upload-artifact@v4
94
+ with :
95
+ name : XCFrameworks
96
+ path : ${{ env.OUTPUT_DIR }}/*.xcframework.zip
97
+ if-no-files-found : error
98
+
99
+ release :
100
+ needs : create-xcframework
101
+ runs-on : ubuntu-latest
102
+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
103
+ steps :
104
+ - name : Download XCFrameworks
105
+ uses : actions/download-artifact@v4
106
+ with :
107
+ name : XCFrameworks
108
+
109
+ - name : Determine Release Version
110
+ id : version
111
+ run : |
112
+ if [[ $GITHUB_REF == refs/tags/* ]]; then
113
+ VERSION=${GITHUB_REF#refs/tags/}
114
+ elif [[ "${{ github.event.inputs.release_version }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
115
+ VERSION=${{ github.event.inputs.release_version }}
116
+ else
117
+ echo "Error: Invalid version format. Must start with 'v' followed by semantic versioning."
118
+ exit 1
119
+ fi
120
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
121
+
105
122
- name : Create Release and Upload XCFrameworks
106
123
uses : softprops/action-gh-release@v2
107
- if : github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch'
108
124
with :
109
125
tag_name : ${{ steps.version.outputs.version }}
110
126
name : Release ${{ steps.version.outputs.version }}
@@ -113,7 +129,7 @@ jobs:
113
129
generate_release_notes : true
114
130
fail_on_unmatched_files : true
115
131
files : |
116
- ${{ env.OUTPUT_DIR }}/ *.xcframework.zip
132
+ *.xcframework.zip
117
133
env :
118
134
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
119
135
@@ -127,10 +143,3 @@ jobs:
127
143
assets=$(echo "$release_info" | jq -r '.assets[].name')
128
144
echo "Release assets:"
129
145
echo "$assets"
130
-
131
- - name : Upload XCFrameworks as Workflow Artifacts
132
- uses : actions/upload-artifact@v4
133
- with :
134
- name : XCFrameworks
135
- path : ${{ env.OUTPUT_DIR }}/*.xcframework.zip
136
- if-no-files-found : error
0 commit comments