Skip to content

Commit 1f972a0

Browse files
committed
chore(ci):Update CI workflows: add iOS build support and upgrade Flutter to 3.32.7
1 parent e9d316a commit 1f972a0

File tree

2 files changed

+135
-7
lines changed

2 files changed

+135
-7
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
7575
- uses: subosito/flutter-action@v2
7676
with:
77-
flutter-version: '3.19.6'
77+
flutter-version: '3.32.7'
7878
- run: flutter build apk --split-per-abi --release
7979

8080
- name: Upload missing_rules.txt
@@ -168,7 +168,7 @@ jobs:
168168

169169
- uses: subosito/flutter-action@v2
170170
with:
171-
flutter-version: '3.19.6'
171+
flutter-version: '3.32.7'
172172

173173
- name: Build iOS App
174174
run: |

.github/workflows/release.yaml

Lines changed: 133 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ name: Release
33
on:
44
push:
55
branches:
6-
- "master"
6+
- "main"
77
paths:
88
- "CHANGELOG.md"
99
workflow_dispatch:
1010

11+
permissions:
12+
contents: write
13+
1114
jobs:
12-
android:
15+
android:
1316
runs-on: ubuntu-latest
1417
env:
1518
output: "${{ github.workspace }}/build/app/outputs/apk/release"
@@ -71,7 +74,7 @@ jobs:
7174
7275
- uses: subosito/flutter-action@v2
7376
with:
74-
flutter-version: '3.19.6'
77+
flutter-version: '3.32.7'
7578
- run: flutter build apk --split-per-abi --release
7679

7780
- name: Upload missing_rules.txt
@@ -85,13 +88,138 @@ jobs:
8588
run: |
8689
echo "ver_name=$(grep -m 1 'versionName' ${{ env.output }}/output-metadata.json | cut -d\" -f4)" >> $GITHUB_ENV
8790
91+
- name: Upload Android APKs for Release
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: "android-release-files"
95+
path: "${{ env.output }}/*.apk"
96+
97+
ios:
98+
runs-on: macos-latest
99+
env:
100+
output: "${{ github.workspace }}/build/ios/ipa"
101+
steps:
102+
- uses: actions/checkout@v3
103+
with:
104+
fetch-depth: 0
105+
106+
- uses: actions/setup-go@v5
107+
with:
108+
go-version: 1.22
109+
110+
- name: Download OpenList Source Code
111+
run: |
112+
cd $GITHUB_WORKSPACE/openlist-lib/scripts
113+
chmod +x *.sh
114+
echo "Initializing OpenList..."
115+
./init_openlist.sh
116+
echo "Initializing Web assets for iOS..."
117+
./init_web_ios.sh
118+
119+
- name: Verify Go Installation
120+
run: |
121+
which go
122+
go version
123+
echo "GOPATH: $GOPATH"
124+
echo "GOROOT: $GOROOT"
125+
126+
- name: Build OpenList for iOS
127+
run: |
128+
cd $GITHUB_WORKSPACE/openlist-lib/scripts
129+
chmod +x *.sh
130+
echo "Initializing gomobile for iOS..."
131+
./init_gomobile.sh
132+
echo "Checking Go mobile installation..."
133+
go list -m golang.org/x/mobile 2>/dev/null || echo "mobile module not found"
134+
which gomobile || echo "gomobile not in PATH"
135+
which gobind || echo "gobind not in PATH"
136+
echo "Checking openlistlib directory..."
137+
ls -la ../openlistlib/ || echo "openlistlib directory not found"
138+
echo "Checking for problematic imports..."
139+
if [ -d ../openlistlib ]; then
140+
echo "Go files in openlistlib:"
141+
ls -la ../openlistlib/*.go 2>/dev/null || echo "No Go files found"
142+
echo "Checking imports:"
143+
grep -r "golang.org/x/mobile/bind" ../openlistlib/ 2>/dev/null || echo "No bind imports found"
144+
fi
145+
echo "Building iOS framework..."
146+
./gobind_ios.sh
147+
148+
- name: Upload iOS Framework
149+
uses: actions/upload-artifact@v4
150+
with:
151+
name: "OpenList-iOS"
152+
path: "${{ github.workspace }}/ios/Frameworks/*.xcframework"
153+
154+
- uses: subosito/flutter-action@v2
155+
with:
156+
flutter-version: '3.32.7'
157+
158+
- name: Build iOS App
159+
run: |
160+
flutter build ios --release --no-codesign
161+
162+
- name: Create IPA
163+
run: |
164+
mkdir -p ${{ env.output }}
165+
cd build/ios/iphoneos
166+
mkdir Payload
167+
cp -r Runner.app Payload/
168+
zip -r ${{ env.output }}/OpenListFlutter.ipa Payload/
169+
170+
- name: Get App Version
171+
run: |
172+
# Get base version from openlist_version file and add timestamp
173+
BASE_VERSION=$(cat openlist_version)
174+
# Generate timestamp in format YYMMDDHH (精确到小时)
175+
TIMESTAMP=$(date +%y%m%d%H)
176+
# Combine version with timestamp for artifact naming
177+
echo "ver_name=${BASE_VERSION}.${TIMESTAMP}" >> $GITHUB_ENV
178+
179+
- name: Upload iOS IPA for Release
180+
uses: actions/upload-artifact@v4
181+
with:
182+
name: "ios-release-files"
183+
path: "${{ env.output }}/OpenListFlutter.ipa"
184+
185+
release:
186+
needs: [android, ios]
187+
runs-on: ubuntu-latest
188+
steps:
189+
- uses: actions/checkout@v3
190+
with:
191+
fetch-depth: 0
192+
193+
- name: Download Android artifacts
194+
uses: actions/download-artifact@v4
195+
with:
196+
name: android-release-files
197+
path: release_files/
198+
199+
- name: Download iOS artifacts
200+
uses: actions/download-artifact@v4
201+
with:
202+
name: ios-release-files
203+
path: release_files/
204+
205+
- name: Get Version Name
206+
run: |
207+
# Use the same version logic as Android build
208+
if [ -f "openlist_version" ]; then
209+
BASE_VERSION=$(cat openlist_version)
210+
TIMESTAMP=$(date +%y%m%d%H)
211+
echo "ver_name=${BASE_VERSION}.${TIMESTAMP}" >> $GITHUB_ENV
212+
else
213+
echo "ver_name=v1.0.0" >> $GITHUB_ENV
214+
fi
215+
88216
- uses: softprops/action-gh-release@v1
89217
with:
90218
name: ${{ env.ver_name }}
91219
tag_name: ${{ env.ver_name }}
92220
body_path: ${{ github.workspace }}/CHANGELOG.md
93221
draft: false
94222
prerelease: false
95-
files: ${{ env.output }}/*.apk
223+
files: release_files/*
96224
env:
97-
GITHUB_TOKEN: ${{ secrets.TOKEN }}
225+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)