@@ -39,14 +39,12 @@ jobs:
3939 run : |
4040 git config --global user.name "github-actions[bot]"
4141 git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
42-
43- # Get commit message
42+
4443 commit_message=$(git log -1 --pretty=format:"%s")
45-
44+
4645 git clone --branch=version https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} version
4746 cd version
4847
49- # Read and increment version name
5048 IFS='.' read -r major minor patch < versionName.txt
5149
5250 if [[ "$commit_message" =~ ^feat: ]]; then
@@ -56,18 +54,17 @@ jobs:
5654 next_minor=$((minor))
5755 next_patch=$((patch + 1))
5856 fi
57+
5958 next_version_name="$major.$next_minor.$next_patch"
6059 echo "VERSION_NAME=$next_version_name" >> $GITHUB_OUTPUT
6160 echo "$next_version_name" > versionName.txt
6261
63- # Read and increment version code
6462 read -r version_code < versionCode.txt
65-
63+
6664 new_version_code=$((version_code + 1))
6765 echo "VERSION_CODE=$new_version_code" >> $GITHUB_OUTPUT
6866 echo "$new_version_code" > versionCode.txt
6967
70- # Force push to version branch
7168 git checkout --orphan temporary
7269 git add --all .
7370 git commit -am "[Auto] Update versionName: $next_version_name & versionCode: $new_version_code ($(date +%Y-%m-%d.%H:%M:%S))"
@@ -100,58 +97,17 @@ jobs:
10097 VERSION_CODE : ${{needs.common.outputs.VERSION_CODE}}
10198
10299 - name : Upload APK
103- uses : actions/upload-artifact@v7
100+ uses : actions/upload-artifact@v4
104101 with :
105102 name : APK Generated
106103 path : build/app/outputs/flutter-apk
107104
108105 - name : Upload AAB Release
109- uses : actions/upload-artifact@v7
106+ uses : actions/upload-artifact@v4
110107 with :
111108 name : AAB Generated
112109 path : build/app/outputs/bundle
113110
114- - name : Upload APK/AAB to app branch
115- if : ${{ github.repository == 'fossasia/pslab-app' }}
116- run : |
117- git config --global user.name "github-actions[bot]"
118- git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
119-
120- git clone --branch=app https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} app
121- cd app
122-
123- branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
124-
125- echo "Removing previous files from branch"
126-
127- rm -rf pslab-$branch*
128-
129- ls
130-
131- echo "Copying new build files"
132-
133- find ../build/app/outputs/flutter-apk -type f \( -name '*release.apk' -o -name '*release.aab' \) -exec cp -v {} . \;
134- find ../build/app/outputs/bundle -type f \( -name '*release.apk' -o -name '*release.aab' \) -exec cp -v {} . \;
135-
136- ls
137-
138- echo "Renaming new build files"
139-
140- for file in app*; do
141- mv $file pslab-$branch-${file#*-}
142- done
143-
144- ls
145-
146- echo "Pushing to app branch"
147-
148- git checkout --orphan temporary
149- git add --all .
150- git commit -am "[Auto] Update APK/AABs from $branch ($(date +%Y-%m-%d.%H:%M:%S))"
151- git branch -D app
152- git branch -m app
153- git push --force origin app
154-
155111 - name : Update app in Open Testing track
156112 if : ${{ github.repository == 'fossasia/pslab-app' }}
157113 run : |
@@ -192,7 +148,7 @@ jobs:
192148 fastlane setupCertificates
193149 if [[ $? -ne 0 ]]; then
194150 exit 1
195- fi
151+ fi
196152
197153 - name : iOS Workflow
198154 uses : ./.github/actions/ios
@@ -207,67 +163,8 @@ jobs:
207163 fastlane uploadToBeta
208164 if [[ $? -ne 0 ]]; then
209165 exit 1
210- fi
211-
212- update-release :
213- name : Update Draft Release
214- needs : [ common, android, ios, windows, linux, linux-arm64, macos ]
215- runs-on : ubuntu-latest
216- steps :
217- - name : Run Release Drafter
218- uses : release-drafter/release-drafter@v7
219- env :
220- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
221- with :
222- version : ${{ needs.common.outputs.VERSION_NAME }}
223-
224- screenshots-android :
225- name : Screenshots (Android)
226- runs-on : ubuntu-latest
227- timeout-minutes : 30
228- steps :
229- - uses : actions/checkout@v6
230-
231- - name : Android Screenshot Workflow
232- uses : ./.github/actions/screenshot-android
233- with :
234- ANDROID_EMULATOR_API : ${{ env.ANDROID_EMULATOR_API }}
235- ANDROID_EMULATOR_ARCH : ${{ env.ANDROID_EMULATOR_ARCH }}
236-
237- screenshots-iphone :
238- name : Screenshots (iPhone)
239- runs-on : macos-latest
240- timeout-minutes : 30
241- steps :
242- - name : Set up Xcode
243- uses : maxim-lobanov/setup-xcode@v1.7.0
244- with :
245- xcode-version : ' 26.3.0'
246-
247- - uses : actions/checkout@v6
248-
249- - name : iPhone Screenshot Workflow
250- uses : ./.github/actions/screenshot-iphone
251- with :
252- IPHONE_DEVICE_MODEL : ${{ env.IPHONE_DEVICE_MODEL }}
253-
254- screenshots-ipad :
255- name : Screenshots (iPad)
256- runs-on : macos-latest
257- timeout-minutes : 30
258- steps :
259- - name : Set up Xcode
260- uses : maxim-lobanov/setup-xcode@v1.7.0
261- with :
262- xcode-version : ' 26.3.0'
263-
264- - uses : actions/checkout@v6
166+ fi
265167
266- - name : iPad Screenshot Workflow
267- uses : ./.github/actions/screenshot-ipad
268- with :
269- IPAD_DEVICE_MODEL : ${{ env.IPAD_DEVICE_MODEL }}
270-
271168 windows :
272169 name : Windows Flutter Build
273170 needs : common
@@ -281,35 +178,12 @@ jobs:
281178 VERSION_NAME : ${{needs.common.outputs.VERSION_NAME}}
282179 VERSION_CODE : ${{needs.common.outputs.VERSION_CODE}}
283180
284- - name : Upload installer to app branch
285- if : ${{ github.repository == 'fossasia/pslab-app' }}
286- shell : bash
287- run : |
288- git config --global user.name "github-actions[bot]"
289- git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
290-
291- git clone --branch=app https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} app
292- cd app
293-
294- branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
295-
296- echo "Removing previous files from branch"
297-
298- rm -rf *.exe
299-
300- echo "Copying new build files"
301-
302- cp -v ../build/windows/x64/installer/Release/*.exe .
303-
304- echo "Pushing to app branch"
181+ - name : Upload Windows Installer
182+ uses : actions/upload-artifact@v4
183+ with :
184+ name : Windows Installer
185+ path : build/windows/x64/installer/Release/*.exe
305186
306- git checkout --orphan temporary
307- git add --all .
308- git commit -am "[Auto] Update Windows Installer from $branch ($(date +%Y-%m-%d.%H:%M:%S))"
309- git branch -D app
310- git branch -m app
311- git push --force origin app
312-
313187 linux :
314188 name : Linux Flutter Build
315189 needs : common
@@ -323,35 +197,13 @@ jobs:
323197 VERSION_NAME : ${{needs.common.outputs.VERSION_NAME}}
324198 VERSION_CODE : ${{needs.common.outputs.VERSION_CODE}}
325199
326- - name : Upload packages to app branch
327- if : ${{ github.repository == 'fossasia/pslab-app' }}
328- run : |
329- git config --global user.name "github-actions[bot]"
330- git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
331-
332- git clone --branch=app https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} app
333- cd app
334-
335- branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
336-
337- echo "Removing previous files from branch"
338-
339- find . -maxdepth 1 -type f -name '*.deb' ! -name '*arm64*' -delete
340- find . -maxdepth 1 -type f -name '*.rpm' ! -name '*aarch64*' -delete
341-
342- echo "Copying new build files"
343-
344- cp -v ../*.deb .
345- cp -v ../*.rpm .
346-
347- echo "Pushing to app branch"
348-
349- git checkout --orphan temporary
350- git add --all .
351- git commit -am "[Auto] Update Linux Packages from $branch ($(date +%Y-%m-%d.%H:%M:%S))"
352- git branch -D app
353- git branch -m app
354- git push --force origin app
200+ - name : Upload Linux Packages
201+ uses : actions/upload-artifact@v4
202+ with :
203+ name : Linux Packages
204+ path : |
205+ *.deb
206+ *.rpm
355207
356208 linux-arm64 :
357209 name : Linux ARM64 Flutter Build
@@ -366,34 +218,13 @@ jobs:
366218 VERSION_NAME : ${{needs.common.outputs.VERSION_NAME}}
367219 VERSION_CODE : ${{needs.common.outputs.VERSION_CODE}}
368220
369- - name : Upload packages to app branch
370- if : ${{ github.repository == 'fossasia/pslab-app' }}
371- run : |
372- git config --global user.name "github-actions[bot]"
373- git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
374-
375- git clone --branch=app https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} app
376- cd app
377-
378- branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
379-
380- echo "Removing previous files from branch"
381-
382- rm -rf *arm64*.deb *aarch64*.rpm
383-
384- echo "Copying new build files"
385-
386- cp -v ../*.deb .
387- cp -v ../*.rpm .
388-
389- echo "Pushing to app branch"
390-
391- git checkout --orphan temporary
392- git add --all .
393- git commit -am "[Auto] Update Linux ARM64 Packages from $branch ($(date +%Y-%m-%d.%H:%M:%S))"
394- git branch -D app
395- git branch -m app
396- git push --force origin app
221+ - name : Upload Linux ARM64 Packages
222+ uses : actions/upload-artifact@v4
223+ with :
224+ name : Linux ARM64 Packages
225+ path : |
226+ *.deb
227+ *.rpm
397228
398229 macos :
399230 name : macOS Flutter Build
@@ -408,30 +239,72 @@ jobs:
408239 VERSION_NAME : ${{needs.common.outputs.VERSION_NAME}}
409240 VERSION_CODE : ${{needs.common.outputs.VERSION_CODE}}
410241
411- - name : Upload dmg to app branch
412- if : ${{ github.repository == 'fossasia/pslab-app' }}
242+ - name : Upload macOS DMG
243+ uses : actions/upload-artifact@v4
244+ with :
245+ name : macOS DMG
246+ path : ' *.dmg'
247+
248+ publish-app-branch :
249+ name : Publish artifacts to app branch
250+ needs : [android, windows, linux, linux-arm64, macos]
251+ if : ${{ github.repository == 'fossasia/pslab-app' }}
252+ runs-on : ubuntu-latest
253+
254+ concurrency :
255+ group : upload-to-app-branch
256+ cancel-in-progress : false
257+
258+ steps :
259+ - uses : actions/checkout@v6
260+
261+ - name : Download all artifacts
262+ uses : actions/download-artifact@v4
263+ with :
264+ path : artifacts
265+
266+ - name : Publish artifacts to app branch
413267 run : |
268+ set -euo pipefail
269+
414270 git config --global user.name "github-actions[bot]"
415271 git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
416272
417273 git clone --branch=app https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} app
274+
418275 cd app
419-
276+
420277 branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
421278
422- echo "Removing previous files from branch "
279+ echo "Removing old artifacts "
423280
424- rm -rf *. dmg
281+ find . -maxdepth 1 -type f \( -name '*.apk' -o -name '*.aab' -o -name '*.exe' -o -name '*.deb' -o -name '*.rpm' -o -name '*. dmg' \) -delete
425282
426- echo "Copying new build files "
283+ echo "Copying new artifacts "
427284
428- cp -v ../*.dmg .
285+ find ../artifacts -type f \( \
286+ -name '*.apk' -o \
287+ -name '*.aab' -o \
288+ -name '*.exe' -o \
289+ -name '*.deb' -o \
290+ -name '*.rpm' -o \
291+ -name '*.dmg' \
292+ \) -exec cp -v {} . \;
429293
430- echo "Pushing to app branch"
294+ echo "Renaming Android artifacts"
295+
296+ for file in app*; do
297+ [ -e "$file" ] || continue
298+ mv "$file" "pslab-$branch-${file#*-}"
299+ done
431300
432301 git checkout --orphan temporary
433302 git add --all .
434- git commit -am "[Auto] Update macOS DMG from $branch ($(date +%Y-%m-%d.%H:%M:%S))"
303+
304+ git diff --cached --quiet && echo "No changes to commit" && exit 0
305+
306+ git commit -m "[Auto] Update artifacts from $branch ($(date +%Y-%m-%d.%H:%M:%S))"
307+
435308 git branch -D app
436309 git branch -m app
437310 git push --force origin app
0 commit comments