name: 'Update Reference Screenshots' description: 'Update Reference Screenshots' on: workflow_dispatch: runs: using: 'composite' steps: - uses: actions/setup-node@v4 with: node-version: 18.x - uses: actions/download-artifact@v4 with: path: ./artifacts - name: Extract Archives # This finds all .zip files in the ./artifacts # directory, including nested directories. # It then unzips every .zip to the root directory run: | find . -type f -name 'UpdatedScreenshots-*.zip' -exec unzip -q -o -d ../ {} \; shell: bash working-directory: ./artifacts - name: Push Screenshots # Configure user as Ionitron # and push only the changed .png snapshots # to the remote branch. # Screenshots are in .gitignore # to prevent local screenshots from getting # pushed to Git. As a result, we need --force # here so that CI generated screenshots can # get added to git. Screenshot ground truths # should only be added via this CI process. run: | git config user.name ionitron git config user.email hi@ionicframework.com # This adds an empty entry for new # screenshot files so we can track them with # git diff git add src/\*.png --force -N if git diff --exit-code; then echo -e "\033[1;31m⚠️ Error: No new screenshots generated ⚠️\033[0m" echo -e "\033[1;31mThis means that there were zero visual diffs when running screenshot tests.\033[0m" echo -e "\033[1;31mMake sure you have pushed any code changes that would result in visual diffs.\033[0m" exit 1 else # This actually adds the contents # of the screenshots (including new ones) git add src/\*.png --force git commit -m "chore(): add updated snapshots" git push fi shell: bash working-directory: ./core