WOOMOB-2818 Add previous-period parallel fetch and trend badge in store widget #44909
This file contains hidden or 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: Screenshots | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, labeled, unlabeled] | |
| env: | |
| CONFIGURE_ENCRYPTION_KEY: ${{ secrets.CONFIGURE_ENCRYPTION_KEY }} | |
| jobs: | |
| build: | |
| name: Build Application | |
| # Only run for PRs from the same repo (not forks) and with the 'generate screenshots' label | |
| if: | | |
| github.event.pull_request.head.repo.fork != true && | |
| contains(github.event.pull_request.labels.*.name, 'generate screenshots') | |
| runs-on: macos-latest | |
| steps: | |
| - name: "Check out Project" | |
| uses: actions/checkout@v4 | |
| - name: "Set up Ruby" | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| bundler-cache: true | |
| - name: Install App Dependencies | |
| run: bundle exec rake dependencies | |
| - name: Compile the App | |
| run: bundle exec fastlane build_screenshots | |
| - name: Archive Build Products | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: screenshot-build-products | |
| path: fastlane/DerivedData/Build/Products/Debug-iphonesimulator/ | |
| retention-days: 1 | |
| capture: | |
| name: Capture | |
| needs: build | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| language: [ar-SA, de-DE, en-US, es-ES, fr-FR, he, id, it, ja, ko, nl-NL, pt-BR, ru, sv, tr, zh-Hans, zh-Hant] | |
| mode: [dark, light] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: "Set up Ruby" | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| bundler-cache: true | |
| - name: Install Fastlane Dependencies | |
| run: bundle exec fastlane run configure_apply | |
| - name: Download Build Products | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: screenshot-build-products | |
| path: fastlane/DerivedData/Build/Products/Debug-iphonesimulator/ | |
| - name: Generate Screenshots | |
| run: | | |
| bundle exec fastlane take_screenshots languages:${{ matrix.language }} mode:${{ matrix.mode }} | |
| - name: Store Logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: "screenshot-log-${{ matrix.language }}-${{ matrix.mode }}" | |
| path: fastlane/logs | |
| - name: Archive Generated Screenshots | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: "screenshots-${{ matrix.language }}-${{ matrix.mode }}" | |
| path: fastlane/screenshots/ | |
| process: | |
| name: "Process Screenshots" | |
| needs: capture | |
| runs-on: macos-latest | |
| permissions: | |
| # Push the generated-screenshots branch | |
| contents: write | |
| # Create PR from the generated-screenshots branch to the original PR branch | |
| pull-requests: write | |
| env: | |
| BUNDLE_WITH: screenshots | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| # Checkout the PR branch directly (not the merge commit) so we can push back to it | |
| ref: ${{ github.head_ref }} | |
| # Fetch LFS files for promo screenshot generation | |
| lfs: true | |
| - name: Create screenshots branch | |
| run: | | |
| COMMIT_SHA=$(git rev-parse --short HEAD) | |
| SCREENSHOTS_BRANCH="generated-screenshots/${COMMIT_SHA}" | |
| echo "SCREENSHOTS_BRANCH=${SCREENSHOTS_BRANCH}" >> $GITHUB_ENV | |
| git checkout -b "${SCREENSHOTS_BRANCH}" | |
| - name: Install Native Dependencies | |
| run: | | |
| brew install imagemagick@7 | |
| brew link imagemagick@7 --force | |
| brew install automattic/build-tools/drawText | |
| - name: "Set up Ruby" | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| bundler-cache: true | |
| - name: Install Fastlane Dependencies | |
| run: bundle exec fastlane run configure_apply | |
| - name: Download Generated Screenshots | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: "screenshots-*" | |
| path: fastlane/screenshots/ | |
| merge-multiple: true | |
| - name: Generate Screenshot Summary | |
| run: | | |
| bundle exec fastlane create_screenshot_summary | |
| - name: Upload Screenshot Summary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: screenshot-summary | |
| path: fastlane/screenshots/screenshots.html | |
| - name: Archive Raw Screenshots | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: raw-screenshots | |
| path: fastlane/screenshots | |
| - name: Configure Git for committing | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Generate Promo Screenshots | |
| run: | | |
| bundle exec fastlane create_promo_screenshots force:true commit:true | |
| - name: Archive Promo Screenshots | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: promo-screenshots | |
| path: fastlane/promo_screenshots | |
| - name: Push screenshots branch and create PR | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| # Check if there are any commits to push (the lane may have committed nothing) | |
| if git diff --quiet origin/${{ github.head_ref }}..HEAD; then | |
| echo "No new screenshots to commit" | |
| exit 0 | |
| fi | |
| git push origin "${SCREENSHOTS_BRANCH}" | |
| # Note: GHA doesn't provide a run URL variable, so we build it from components | |
| gh pr create \ | |
| --base "${{ github.head_ref }}" \ | |
| --head "${SCREENSHOTS_BRANCH}" \ | |
| --label "category: screenshots" \ | |
| --title "Add generated screenshots" \ | |
| --body "This PR adds the screenshots generated from #${{ github.event.pull_request.number }}. | |
| Merge this PR to add the screenshots to your branch. | |
| --- | |
| _Automatically generated by the [Screenshots workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})._" |