Take Screenshots #30
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 | |
- uses: actions/download-artifact@v3 | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Install markdown-include | |
run: pip install markdown-include | |
- name: Run tests and take screenshots | |
run: | | |
sudo apt-get install -y xvfb | |
export DISPLAY=:99 | |
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & | |
flutter drive --target="./test_driver/screenshot.dart" | |
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 |