Skip to content

Commit 8f35e64

Browse files
authored
Merge branch 'development' into build-versions
2 parents 31bb076 + 0295001 commit 8f35e64

39 files changed

+952
-469
lines changed

.github/actions/android/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ runs:
3636
uses: subosito/flutter-action@v2
3737
with:
3838
cache: true
39+
flutter-version-file: pubspec.yaml
3940

4041
- name: Build Android APK/AAB
4142
shell: bash

.github/actions/common/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ runs:
77
uses: subosito/flutter-action@v2
88
with:
99
cache: true
10+
flutter-version-file: pubspec.yaml
1011

1112
- name: Fetch Flutter Dependencies
1213
shell: bash

.github/actions/ios/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ runs:
1717
uses: subosito/flutter-action@v2
1818
with:
1919
cache: true
20+
flutter-version-file: pubspec.yaml
2021

2122
- name: Update Podfile
2223
shell: bash

.github/actions/screenshot-android/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ runs:
5353
uses: subosito/flutter-action@v2
5454
with:
5555
cache: true
56+
flutter-version-file: pubspec.yaml
5657

5758
- name: Create Android Screenshots
5859
uses: reactivecircus/android-emulator-runner@v2

.github/actions/screenshot-ios/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ runs:
1717
uses: subosito/flutter-action@v2
1818
with:
1919
cache: true
20+
flutter-version-file: pubspec.yaml
2021

2122
- name: Update Podfile
2223
shell: bash
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Clean PR Screenshots
2+
3+
on:
4+
schedule:
5+
- cron: '0 3 * * 0'
6+
workflow_dispatch:
7+
8+
env:
9+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10+
11+
jobs:
12+
cleanup:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
ref: pr-screenshots
19+
20+
- name: Delete screenshots from closed PRs
21+
run: |
22+
open_prs=$(gh pr list --state open --json number -q '.[].number')
23+
24+
for file in *.png; do
25+
pr_num=$(echo "$file" | cut -d'_' -f1)
26+
if ! echo "$open_prs" | grep -qw "$pr_num"; then
27+
rm "$file"
28+
fi
29+
done
30+
31+
- name: Commit and push changes
32+
run: |
33+
git config --global user.name "github-actions[bot]"
34+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
35+
36+
# Force push to pr-screenshots branch
37+
git checkout --orphan temporary
38+
git add --all .
39+
git commit -am "[Auto] Clean screenshots ($(date +%Y-%m-%d.%H:%M:%S))"
40+
git branch -D pr-screenshots
41+
git branch -m pr-screenshots
42+
git push --force origin pr-screenshots
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Flutter Upgrade Check
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * 1" # Every Monday at 00:00
6+
workflow_dispatch:
7+
8+
jobs:
9+
check-flutter-upgrade:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Read Flutter version from pubspec.yaml
17+
id: read-version
18+
run: |
19+
FLUTTER_VERSION=$(yq '.environment.flutter' pubspec.yaml)
20+
echo "Current Flutter version: $FLUTTER_VERSION"
21+
echo "flutter_version=$FLUTTER_VERSION" >> $GITHUB_ENV
22+
23+
- name: Get latest stable Flutter version
24+
id: check-latest
25+
run: |
26+
LATEST_VERSION=$(curl -s https://storage.googleapis.com/flutter_infra_release/releases/releases_linux.json | jq -r '.releases[] | select(.channel == "stable") | .version' | head -n 1)
27+
echo "Latest stable Flutter version: $LATEST_VERSION"
28+
echo "latest_flutter_version=$LATEST_VERSION" >> $GITHUB_ENV
29+
30+
- name: Compare versions and update pubspec.yaml if needed
31+
id: update-version
32+
run: |
33+
if [ "$flutter_version" != "$latest_flutter_version" ]; then
34+
echo "Updating Flutter version in pubspec.yaml..."
35+
sed -i "s/flutter:\s*'${flutter_version}'/flutter: '${latest_flutter_version}'/" pubspec.yaml
36+
git --no-pager diff
37+
echo "update_needed=true" >> $GITHUB_ENV
38+
else
39+
echo "Flutter is up to date."
40+
echo "update_needed=false" >> $GITHUB_ENV
41+
fi
42+
43+
- name: Commit and create PR if update is needed
44+
if: env.update_needed == 'true'
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
run: |
48+
git config --global user.name "dependabot[bot]"
49+
git config --global user.email "49699333+dependabot[bot]@users.noreply.github.com"
50+
51+
BRANCH_NAME="flutter-upgrade-${{ env.latest_flutter_version }}"
52+
git checkout -b $BRANCH_NAME
53+
git add pubspec.yaml
54+
git commit -m "chore: Upgrade Flutter to ${{ env.latest_flutter_version }}"
55+
git push origin -f $BRANCH_NAME
56+
57+
PR_URL=$(gh pr create --title "chore(deps): upgrade Flutter to ${{ env.latest_flutter_version }}" \
58+
--body "This PR updates Flutter version in pubspec.yaml to the latest stable release." \
59+
--base flutter_app \
60+
--head $BRANCH_NAME)
61+
62+
# Close and reopen the PR to trigger workflows
63+
# More info: https://github.com/orgs/community/discussions/65321
64+
sleep 10
65+
gh pr close "$PR_URL"
66+
sleep 5
67+
gh pr reopen "$PR_URL"

.github/workflows/pull_request.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Badge Magic PR CI
22

33
on:
44
pull_request:
5-
branches: [ "flutter_app" ]
5+
branches: [ "development" ]
66

77
env:
88
ANDROID_EMULATOR_API: 34
@@ -45,6 +45,11 @@ jobs:
4545
needs: common
4646
runs-on: macos-latest
4747
steps:
48+
- name: Set up Xcode
49+
uses: maxim-lobanov/[email protected]
50+
with:
51+
xcode-version: latest
52+
4853
- uses: actions/checkout@v4
4954

5055
- name: iOS Workflow
@@ -66,6 +71,11 @@ jobs:
6671
name: Screenshots (iOS)
6772
runs-on: macos-latest
6873
steps:
74+
- name: Set up Xcode
75+
uses: maxim-lobanov/[email protected]
76+
with:
77+
xcode-version: latest
78+
6979
- uses: actions/checkout@v4
7080

7181
- name: iOS Screenshot Workflow
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Delete Screenshots
2+
3+
on:
4+
pull_request_target:
5+
branches: [ "development" ]
6+
types:
7+
- closed
8+
9+
env:
10+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11+
12+
jobs:
13+
delete_screenshots:
14+
name: Delete Screenshots
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Delete Screenshots
18+
run: |
19+
git config --global user.name "github-actions[bot]"
20+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
21+
22+
git clone --branch=pr-screenshots --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} pr-screenshots
23+
cd pr-screenshots
24+
25+
rm -f ${{ github.event.number }}_*.png
26+
27+
# Force push to pr-screenshots branch
28+
git checkout --orphan temporary
29+
git add --all .
30+
git commit -am "[Auto] Delete screenshots for #${{ github.event.number }} ($(date +%Y-%m-%d.%H:%M:%S))"
31+
git branch -D pr-screenshots
32+
git branch -m pr-screenshots
33+
git push --force origin pr-screenshots

0 commit comments

Comments
 (0)