Take Screenshots #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Take Screenshots | |
on: | |
workflow_run: | |
workflows: ["Flutter CI"] | |
types: | |
- completed | |
jobs: | |
screenshots: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'beta' | |
- name: Install dependencies | |
run: flutter pub get | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: debug-apk | |
- name: Install markdown-include | |
run: pip install markdown-include | |
- 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" # Ensure correct relative path | |
mkdir -p ../screenshots # Create the screenshots directory in the parent directory | |
cp build/screenshots/*.png ../screenshots/ # Copy screenshots to the parent directory | |
- name: Ensure screenshots.md exists | |
run: | | |
if [ ! -f screenshots.md ]; then | |
echo "## Screenshots" > screenshots.md | |
fi | |
- name: Update screenshots.md | |
run: | | |
for screenshot in screenshots/*.png; do | |
echo "![Screenshot](./$screenshot)" >> screenshots.md | |
done | |
- name: Generate Combined README.md | |
run: markdown-include README.md > COMBINED_README.md | |
- 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/ screenshots.md COMBINED_README.md | |
git commit -m 'Update screenshots and README.md' | |
git push |