Skip to content

[Shipping labels] [WiP] Packages repository #32798

[Shipping labels] [WiP] Packages repository

[Shipping labels] [WiP] Packages repository #32798

Workflow file for this run

name: Screenshots
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
env:
S3_BUCKET: ${{ secrets.S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CONFIGURE_ENCRYPTION_KEY: ${{ secrets.CONFIGURE_ENCRYPTION_KEY }}
jobs:
build:
name: Build Application
if: contains(github.event.pull_request.labels.*.name, 'generate screenshots')
runs-on: macos-latest
steps:
- name: "Check out Project"
uses: actions/checkout@v1
- name: "Set up Ruby"
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Restore CocoaPods Dependency Cache
id: restore-cocoapods-dependency-cache
uses: actions/cache@v1
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
- name: Install App Dependencies
run: bundle exec rake dependencies
- name: Compile the App
run: bundle exec fastlane build_screenshots
- name: Archive App
uses: actions/upload-artifact@v1
with:
name: screenshot-app
path: fastlane/DerivedData/Build/Products/Debug-iphonesimulator/WooCommerce.app
- name: Archive Runner
uses: actions/upload-artifact@v1
with:
name: screenshot-runner
path: fastlane/DerivedData/Build/Products/Debug-iphonesimulator/WooCommerceScreenshots-Runner.app
capture:
name: Capture
needs: build
runs-on: macos-latest
strategy:
matrix:
language: [ar, 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@v1
- 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 Screenshot App
uses: actions/download-artifact@v1
with:
name: screenshot-app
path: fastlane/DerivedData/Build/Products/Debug-iphonesimulator/WooCommerce.app
- name: Download Screenshot Runner
uses: actions/download-artifact@v1
with:
name: screenshot-runner
path: fastlane/DerivedData/Build/Products/Debug-iphonesimulator/WooCommerceScreenshots-Runner.app
- name: Generate Screenshots
run: |
bundle exec fastlane take_screenshots languages:${{ matrix.language }} mode:${{ matrix.mode }}
- name: Store Logs
if: always()
uses: actions/upload-artifact@v1
with:
name: "screenshot-log-${{ matrix.language }}-${{ matrix.mode }}"
path: fastlane/logs
- name: Archive Generated Screenshots
run: |
cd fastlane && mkdir $GITHUB_RUN_ID && mv screenshots $GITHUB_RUN_ID
aws s3 cp $GITHUB_RUN_ID s3://$S3_BUCKET/$GITHUB_RUN_ID --recursive --exclude "*.html"
process:
name: "Process Screenshots"
needs: capture
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Install Native Dependencies
run: |
brew install imagemagick@7
brew link imagemagick@7 --force
- name: "Set up Ruby"
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Install Screenshot Gems
run: bundle install --with screenshots
- name: Install Fastlane Dependencies
run: bundle exec fastlane run configure_apply
- name: Download Generated Screenshots
run: |
cd fastlane
aws s3 cp s3://$S3_BUCKET/$GITHUB_RUN_ID/screenshots screenshots/ --recursive --exclude "*.html"
- name: Generate and Upload Screenshot Summary
run: |
bundle exec fastlane create_screenshot_summary
aws s3 cp fastlane/screenshots/screenshots.html s3://$S3_BUCKET/$GITHUB_RUN_ID/screenshots/screenshots.html
- name: Archive Raw Screenshots
uses: actions/upload-artifact@v1
with:
name: raw-screenshots
path: fastlane/screenshots
- name: Install Promo Screenshot Fonts
run: |
aws s3 cp s3://$S3_BUCKET/fonts.zip fonts.zip
unzip fonts.zip
mkdir -p ~/Library/Fonts
cp -v fonts/*.otf ~/Library/Fonts
ls ~/Library/Fonts
mkdir -p /Library/Fonts
cp -v fonts/*.otf /Library/Fonts
ls /Library/Fonts
# Reset the font server in order to use these fonts
atsutil databases -removeUser
atsutil server -shutdown
atsutil server -ping
- name: Generate Promo Screenshots
run: |
git lfs install && git lfs fetch && git lfs pull
bundle exec fastlane create_promo_screenshots force:true
- name: Archive Promo Screenshots
uses: actions/upload-artifact@v1
with:
name: promo-screenshots
path: fastlane/promo_screenshots