Shopify / lighthouse-ci-action

MIT License
100 stars 50 forks source link

[Enhancement] Update action to rely on Shopify CLI 3.x + Theme Access app #52

Closed Poitrin closed 1 year ago

Poitrin commented 1 year ago

WHY are these changes introduced?

Fixes #51:

  1. Lighthouse CI Action is using Shopify CLI 2.x, instead of 3.x
  2. Action is depending on custom app, instead of Theme Access app

WHAT is this pull request doing?

If token for Theme Access app is set, uses CLI 3.x to push theme. Else, continues to use CLI 2.x with custom app token to push theme.

How to test your changes?

  1. cd into repo dir that contains Dockerfile
  2. Check this repo's README → Authentication to set up custom app token
  3. In the script below, write it into INPUT_ACCESS_TOKEN
  4. Follow the steps in https://shopify.dev/themes/tools/theme-access to set up Theme Access App token
  5. In the script below, write it into INPUT_SHOPIFY_CLI_THEME_TOKEN
  6. Build an image with podman build --tag lighthouse . (or docker … if you prefer)
  7. Execute:
    
    INPUT_STORE="....myshopify.com"
    INPUT_PASSWORD="..." # for password-protected stores
    INPUT_ACCESS_TOKEN="..." # for CLI 2.x
    INPUT_SHOPIFY_CLI_THEME_TOKEN="..." # for CLI 3.x

podman run --name lighthouse --rm -i -t \ --mount "type=bind,source=$(pwd)/entrypoint.sh,target=/entrypoint.sh" \ --mount "type=bind,source=$(pwd)/draft,target=/draft" \ -e "INPUT_STORE=$INPUT_STORE" \ -e "INPUT_THEME_ROOT=./draft" \ -e "INPUT_PASSWORD=$INPUT_PASSWORD" \ -e "INPUT_ACCESS_TOKEN=$INPUT_ACCESS_TOKEN" \ -e "INPUT_SHOPIFY_CLI_THEME_TOKEN=$INPUT_SHOPIFY_CLI_THEME_TOKEN" \ lighthouse


8. You should see 3 URLs pointing to `storage.googleapis.com`, in which you can see your Lighthouse performance tests.

### Post-release steps

- [ ] Update https://shopify.dev/themes/tools/lighthouse-ci
- [ ] New release in GitHub
Poitrin commented 1 year ago

Due to additional issues (regarding api_request method in entrypoint.sh using custom app token) appearing during development, it has been decided to pause work on this issue and create a design document to decide how to proceed (see Theme Dev Tools Drive folder → Early technical explorations)

There are still 2 open IT Helpdesk tickets to…

  1. make prebuilt docker image on GHCR.io public
  2. get access to Settings tab to update/add password/tokens

Depending on these tickets' outcomes, I might add changes to the branch, but PR is closed.