Skip to content

Commit 05349cb

Browse files
fix: move iOS build to macOS runner and separate Android/iOS build jobs
1 parent 40f1ee6 commit 05349cb

File tree

1 file changed

+77
-15
lines changed

1 file changed

+77
-15
lines changed

.github/workflows/main.yml

Lines changed: 77 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
name: "Build & Release"
1010

1111
jobs:
12-
build:
13-
name: Build & Test
12+
build-android:
13+
name: Build & Test Android
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v4
@@ -78,36 +78,98 @@ jobs:
7878
run: |
7979
# Using --build-name with the version from our calculation
8080
flutter build apk --release --split-per-abi --build-name=${{ env.VERSION }}
81-
81+
8282
# Rename APKs with proper versioning
8383
cd build/app/outputs/apk/release
8484
mv app-armeabi-v7a-release.apk SysAdmin-v${{ env.VERSION }}-armeabi-v7a.apk
8585
mv app-arm64-v8a-release.apk SysAdmin-v${{ env.VERSION }}-arm64-v8a.apk
8686
mv app-x86_64-release.apk SysAdmin-v${{ env.VERSION }}-x86_64.apk
8787
88-
# Build IPA for iOS
89-
- name: Install iOS dependencies
88+
- name: Upload Android Builds
89+
uses: actions/upload-artifact@v3
90+
with:
91+
name: android-builds
92+
path: |
93+
build/app/outputs/apk/release/SysAdmin-v${{ env.VERSION }}-armeabi-v7a.apk
94+
build/app/outputs/apk/release/SysAdmin-v${{ env.VERSION }}-arm64-v8a.apk
95+
build/app/outputs/apk/release/SysAdmin-v${{ env.VERSION }}-x86_64.apk
96+
97+
build-ios:
98+
name: Build & Test iOS
99+
runs-on: macos-latest
100+
steps:
101+
- uses: actions/checkout@v4
102+
with:
103+
fetch-depth: 0
104+
105+
- name: Get latest release version
106+
id: get_version
90107
run: |
91-
sudo apt-get update
92-
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev
108+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.0.0")
109+
LATEST_VERSION=${LATEST_TAG#v}
110+
IFS='.' read -r MAJOR MINOR PATCH <<< "$LATEST_VERSION"
111+
NEW_PATCH=$((PATCH + 1))
112+
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
113+
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
114+
echo "TAG=v$NEW_VERSION" >> $GITHUB_ENV
115+
116+
- uses: subosito/flutter-action@v2
117+
with:
118+
flutter-version: '3.29.2'
119+
channel: 'stable'
93120

94-
- name: Build IPA
121+
- name: Build iOS App
95122
run: |
96123
flutter build ios --release --no-codesign --build-name=${{ env.VERSION }}
97-
mkdir -p build/ios/iphoneos/Payload
98-
cp -r build/ios/iphoneos/Runner.app build/ios/iphoneos/Payload/
99124
cd build/ios/iphoneos
125+
mkdir -p Payload
126+
cp -r Runner.app Payload/
100127
zip -r SysAdmin-v${{ env.VERSION }}.ipa Payload
101128
102-
# Push to Releases
129+
- name: Upload iOS Build
130+
uses: actions/upload-artifact@v3
131+
with:
132+
name: ios-build
133+
path: build/ios/iphoneos/SysAdmin-v${{ env.VERSION }}.ipa
134+
135+
release:
136+
name: Create Release
137+
needs: [build-android, build-ios]
138+
runs-on: ubuntu-latest
139+
steps:
140+
- uses: actions/checkout@v4
141+
142+
- name: Get version from build
143+
id: get_version
144+
run: |
145+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.0.0")
146+
LATEST_VERSION=${LATEST_TAG#v}
147+
IFS='.' read -r MAJOR MINOR PATCH <<< "$LATEST_VERSION"
148+
NEW_PATCH=$((PATCH + 1))
149+
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
150+
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
151+
echo "TAG=v$NEW_VERSION" >> $GITHUB_ENV
152+
153+
- name: Download Android Builds
154+
uses: actions/download-artifact@v3
155+
with:
156+
name: android-builds
157+
path: artifacts
158+
159+
- name: Download iOS Build
160+
uses: actions/download-artifact@v3
161+
with:
162+
name: ios-build
163+
path: artifacts
164+
103165
- name: Push to Releases
104166
uses: ncipollo/release-action@v1
105167
with:
106168
artifacts: |
107-
build/app/outputs/apk/release/SysAdmin-v${{ env.VERSION }}-armeabi-v7a.apk
108-
build/app/outputs/apk/release/SysAdmin-v${{ env.VERSION }}-arm64-v8a.apk
109-
build/app/outputs/apk/release/SysAdmin-v${{ env.VERSION }}-x86_64.apk
110-
build/ios/iphoneos/SysAdmin-v${{ env.VERSION }}.ipa
169+
artifacts/SysAdmin-v${{ env.VERSION }}-armeabi-v7a.apk
170+
artifacts/SysAdmin-v${{ env.VERSION }}-arm64-v8a.apk
171+
artifacts/SysAdmin-v${{ env.VERSION }}-x86_64.apk
172+
artifacts/SysAdmin-v${{ env.VERSION }}.ipa
111173
token: ${{ secrets.TOKEN }}
112174
tag: ${{ env.TAG }}
113175
name: SysAdmin ${{ env.TAG }}

0 commit comments

Comments
 (0)