Last active
January 17, 2024 05:41
-
-
Save dgrebb/34ba1d5683ee668e6c7282013a4065b9 to your computer and use it in GitHub Desktop.
Install and Cache Playwright from `package.json` Dependencies | GitHub Composite Action
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: "Install and Cache Playwright" | |
description: "Sets up a cache and/or installs Playwright and its browser binaries." | |
author: dgrebb | |
inputs: | |
WORKSPACE_ROOT: | |
description: "The workspace root." | |
required: true | |
runs: | |
using: "composite" | |
steps: | |
- name: Get installed Playwright version | |
shell: bash | |
working-directory: ${{ inputs.WORKSPACE_ROOT }} | |
id: playwright-version | |
run: echo "PLAYWRIGHT_VERSION=$(cat package.json | jq -r '.dependencies.playwright' || 'latest')" >> $GITHUB_ENV | |
- name: Cache playwright binaries | |
uses: actions/cache@v3 | |
id: playwright-cache | |
with: | |
path: | | |
~/.cache/ms-playwright | |
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} | |
- shell: bash | |
working-directory: ${{ inputs.WORKSPACE_ROOT }} | |
run: npm ci | |
- shell: bash | |
if: steps.playwright-cache.outputs.cache-hit != 'true' | |
working-directory: ${{ inputs.WORKSPACE_ROOT }} | |
run: npx playwright install --with-deps | |
- shell: bash | |
if: steps.playwright-cache.outputs.cache-hit != 'true' | |
working-directory: ${{ inputs.WORKSPACE_ROOT }} | |
run: npx playwright install-deps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment