-
Notifications
You must be signed in to change notification settings - Fork 34
194 lines (166 loc) · 5.93 KB
/
build.yaml
File metadata and controls
194 lines (166 loc) · 5.93 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Build
on:
push:
branches:
- "main"
paths-ignore:
- "*.md"
- "*.sh"
- "release.yaml"
# - "sync_frp.yaml"
workflow_dispatch:
jobs:
android:
runs-on: ubuntu-latest
env:
output: "${{ github.workspace }}/build/app/outputs/apk/release"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download OpenList Source Code
run: |
cd $GITHUB_WORKSPACE/openlist-lib/scripts
chmod +x *.sh
./init_openlist.sh
./init_web.sh
- uses: actions/setup-go@v4
with:
go-version: 1.23.4
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25c
- name: Setup Gradle
uses: gradle/gradle-build-action@v2.4.2
- name: Build OpenList
run: |
cd $GITHUB_WORKSPACE/openlist-lib/scripts
chmod +x *.sh
./init_gomobile.sh
./gobind.sh
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: Upload AAR
uses: actions/upload-artifact@v4
with:
name: "OpenList"
path: "${{ github.workspace }}/android/app/libs/*.aar"
- name: Init Signature
run: |
touch local.properties
cd android
echo ALIAS_NAME='${{ secrets.ALIAS_NAME }}' >> local.properties
echo ALIAS_PASSWORD='${{ secrets.ALIAS_PASSWORD }}' >> local.properties
echo KEY_PASSWORD='${{ secrets.KEY_PASSWORD }}' >> local.properties
echo KEY_PATH='./key.jks' >> local.properties
# 从Secrets读取无换行符Base64解码, 然后保存到到app/key.jks
echo ${{ secrets.KEY_STORE }} | base64 --decode > $GITHUB_WORKSPACE/android/app/key.jks
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.6'
- run: flutter build apk --split-per-abi --release
- name: Upload missing_rules.txt
if: failure() && steps.gradle.outcome != 'success'
uses: actions/upload-artifact@v4
with:
name: "missing_rules"
path: "${{ github.workspace }}/build/app/outputs/mapping/release/missing_rules.txt"
- name: Init APP Version Name
run: |
echo "ver_name=$(grep -m 1 'versionName' ${{ env.output }}/output-metadata.json | cut -d'"' -f4)" >> $GITHUB_ENV
- name: Upload App To Artifact arm64-v8a
if: success () || failure ()
uses: actions/upload-artifact@v4
with:
name: "OpenListFlutter-v${{ env.ver_name }}_arm64-v8a"
path: "${{ env.output }}/*-v8a.apk"
- name: Upload App To Artifact arm-v7a
if: success () || failure ()
uses: actions/upload-artifact@v4
with:
name: "OpenListFlutter-v${{ env.ver_name }}_arm-v7a"
path: "${{ env.output }}/*-v7a.apk"
- name: Upload App To Artifact x86
if: success () || failure ()
uses: actions/upload-artifact@v4
with:
name: "OpenListFlutter-v${{ env.ver_name }}_x86_64"
path: "${{ env.output }}/*64.apk"
ios:
runs-on: macos-latest
env:
output: "${{ github.workspace }}/build/ios/ipa"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: 1.23.4
- name: Download OpenList Source Code
run: |
cd $GITHUB_WORKSPACE/openlist-lib/scripts
chmod +x *.sh
echo "Initializing OpenList..."
./init_openlist.sh
echo "Initializing Web assets for iOS..."
./init_web_ios.sh
- name: Verify Go Installation
run: |
which go
go version
echo "GOPATH: $GOPATH"
echo "GOROOT: $GOROOT"
- name: Build OpenList for iOS
run: |
cd $GITHUB_WORKSPACE/openlist-lib/scripts
chmod +x *.sh
echo "Initializing gomobile for iOS..."
./init_gomobile.sh
echo "Checking Go mobile installation..."
go list -m golang.org/x/mobile 2>/dev/null || echo "mobile module not found"
which gomobile || echo "gomobile not in PATH"
which gobind || echo "gobind not in PATH"
echo "Checking openlistlib directory..."
ls -la ../openlistlib/ || echo "openlistlib directory not found"
echo "Checking for problematic imports..."
if [ -d ../openlistlib ]; then
echo "Go files in openlistlib:"
ls -la ../openlistlib/*.go 2>/dev/null || echo "No Go files found"
echo "Checking imports:"
grep -r "golang.org/x/mobile/bind" ../openlistlib/ 2>/dev/null || echo "No bind imports found"
fi
echo "Building iOS framework..."
./gobind_ios.sh
- name: Upload iOS Framework
uses: actions/upload-artifact@v4
with:
name: "OpenList-iOS"
path: "${{ github.workspace }}/ios/Frameworks/*.xcframework"
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.6'
- name: Build iOS App
run: |
flutter build ios --release --no-codesign
- name: Create IPA
run: |
mkdir -p ${{ env.output }}
cd build/ios/iphoneos
mkdir Payload
cp -r Runner.app Payload/
zip -r ${{ env.output }}/OpenListFlutter.ipa Payload/
- name: Get App Version
run: |
echo "ver_name=$(grep -A1 CFBundleShortVersionString ios/Runner/Info.plist | grep string | sed 's/.*<string>\(.*\)<\/string>.*/\1/')" >> $GITHUB_ENV
- name: Upload iOS App To Artifact
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: "OpenListFlutter-iOS-v${{ env.ver_name }}"
path: "${{ env.output }}/OpenListFlutter.ipa"