Skip to content

Commit abddd01

Browse files
Create screenshot.yml
1 parent c83a631 commit abddd01

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/screenshot.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Capture iOS Screenshots
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Change this if your default branch is different
7+
8+
jobs:
9+
screenshot:
10+
runs-on: macos-latest
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/checkout@v4
14+
15+
- name: Set Up Xcode
16+
run: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
17+
18+
- name: Build & Run UI Tests
19+
run: |
20+
xcodebuild test \
21+
-workspace iblot.xcworkspace \
22+
-scheme iblot \
23+
-destination 'platform=iOS Simulator,name=iPhone 14,OS=latest' \
24+
-only-testing iblotUITests/testExample
25+
26+
- name: Find Screenshots
27+
run: |
28+
mkdir -p Screenshots
29+
find ~/Library/Developer/Xcode/DerivedData -name "*.png" -exec cp {} Screenshots/ \;
30+
31+
- name: Commit and Push Screenshots
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+
git add Screenshots/*
36+
git commit -m "Update screenshots" || echo "No changes to commit"
37+
git push
38+
39+
- name: Update README with latest screenshot
40+
run: |
41+
LATEST_IMAGE=$(ls -t Screenshots | head -1)
42+
echo "![](Screenshots/$LATEST_IMAGE)" > README.md
43+
git add README.md
44+
git commit -m "Update README with latest screenshot" || echo "No changes to commit"
45+
git push

0 commit comments

Comments
 (0)