-
Notifications
You must be signed in to change notification settings - Fork 70
136 lines (115 loc) · 4.41 KB
/
build-xcframework.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Build XCFramework
on:
push:
branches: [ main ]
tags:
- 'v*' # This will trigger the workflow on any tag starting with 'v'
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
release_version:
description: 'Release version (e.g., 0.1.6)'
required: false
default: ''
jobs:
build:
runs-on: macos-latest
env:
OUTPUT_DIR: ${{ github.workspace }}/output
steps:
- uses: actions/checkout@v2
- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install autotools
run: |
brew install autoconf automake libtool
- name: Setup build environment
run: |
aclocal && autoconf && automake --add-missing
mkdir -p "$OUTPUT_DIR"
- name: Build for macOS arm64
run: |
./.github/actions/build_library.sh macosx arm64 MacOSX
- name: Build for macOS x86_64
run: |
./.github/actions/build_library.sh macosx x86_64 MacOSX
- name: Build for iOS arm64
run: |
./.github/actions/build_library.sh iphoneos arm64 iPhoneOS
- name: Build for iOS Simulator x86_64
run: |
./.github/actions/build_library.sh iphonesimulator x86_64 iPhoneSimulator
- name: Build for iOS Simulator arm64
run: |
./.github/actions/build_library.sh iphonesimulator arm64 iPhoneSimulator
- name: Create XCFrameworks
run: |
mkdir -p "${OUTPUT_DIR}/Headers/"
rm -rf ${OUTPUT_DIR}/Headers/*
rm -rf ${OUTPUT_DIR}/opencore-amrnb.xcframework
cp -a amrnb/{interf_dec,interf_enc}.h ${OUTPUT_DIR}/Headers/
./.github/actions/create_xcframework.sh opencore-amrnb
rm -rf ${OUTPUT_DIR}/Headers/*
rm -rf ${OUTPUT_DIR}/opencore-amrwb.xcframework
cp -a amrwb/{dec_if,if_rom}.h ${OUTPUT_DIR}/Headers/
./.github/actions/create_xcframework.sh opencore-amrwb
- name: Determine Release Version
id: version
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
elif [ -n "${{ github.event.inputs.release_version }}" ]; then
echo "version=${{ github.event.inputs.release_version }}" >> $GITHUB_OUTPUT
else
echo "version=v${{ github.run_number }}" >> $GITHUB_OUTPUT
fi
- name: List output directory
run: |
echo "Current working directory: $(pwd)"
echo "OUTPUT_DIR: ${{ env.OUTPUT_DIR }}"
echo "Contents of OUTPUT_DIR:"
ls -la ${{ env.OUTPUT_DIR }}
echo "Full paths of .xcframework directories:"
find ${{ env.OUTPUT_DIR }} -name "*.xcframework" -type d
echo "Structure of .xcframework directories:"
find ${{ env.OUTPUT_DIR }} -name "*.xcframework" -type d -exec sh -c 'echo "{}:"; ls -R "{}"' \;
- name: Zip XCFrameworks
run: |
cd ${{ env.OUTPUT_DIR }}
for framework in *.xcframework; do
zip -r "${framework%.xcframework}.xcframework.zip" "$framework"
done
ls -la
- name: Create Release and Upload XCFrameworks
uses: softprops/action-gh-release@v2
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch'
with:
tag_name: ${{ steps.version.outputs.version }}
name: Release ${{ steps.version.outputs.version }}
draft: false
prerelease: false
generate_release_notes: true
fail_on_unmatched_files: true
files: |
${{ env.OUTPUT_DIR }}/*.xcframework.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check Release
run: |
echo "Checking release ${{ steps.version.outputs.version }}"
release_info=$(curl -sS -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ steps.version.outputs.version }})
echo "Release info:"
echo "$release_info" | jq '.'
assets=$(echo "$release_info" | jq -r '.assets[].name')
echo "Release assets:"
echo "$assets"
- name: Upload XCFrameworks as Workflow Artifacts
uses: actions/upload-artifact@v4
with:
name: XCFrameworks
path: ${{ env.OUTPUT_DIR }}/*.xcframework.zip
if-no-files-found: error