-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (41 loc) · 1.4 KB
/
flutter-screenshot.yml
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
name: Flutter Screenshot
on: [push, pull_request]
jobs:
take_screenshots:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: 'stable'
- name: Install dependencies
run: flutter pub get
- name: Ensure screenshots.md exists
run: |
if [ ! -f screenshots.md ]; then
echo "# Screenshots" > screenshots.md
fi
- name: Run tests and take screenshots
run: |
sudo apt-get install -y xvfb
xvfb-run -s "-screen 0 360x800x24" flutter drive --target=test_driver/screenshot_test.dart
mkdir -p screenshots
cp build/screenshots/*.png screenshots/
- name: Commit and push screenshots
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git add screenshots/
git commit -m 'Update screenshots'
git push
- name: Update screenshots.md
run: |
sed -i '/## Screenshots/q' screenshots.md
for screenshot in screenshots/*.png; do
echo "![Screenshot](./$screenshot)" >> screenshots.md
done
git add screenshots.md
git commit -m 'Update screenshots.md with screenshots'
git push