|
| 1 | +name: Build Playwright Images |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - packages/playwright/PLAYWRIGHT_VERSION |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + contents: read |
| 15 | + packages: write |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Read Playwright version |
| 22 | + id: version |
| 23 | + run: | |
| 24 | + VERSION=$(cat packages/playwright/PLAYWRIGHT_VERSION) |
| 25 | + echo "playwright_version=${VERSION}" >> "$GITHUB_OUTPUT" |
| 26 | +
|
| 27 | + - name: Compute image tags |
| 28 | + id: tags |
| 29 | + run: | |
| 30 | + VERSION="${{ steps.version.outputs.playwright_version }}" |
| 31 | + NODE_TAGS="ghcr.io/dvflw/mantle-playwright-node:${VERSION}" |
| 32 | + PY_TAGS="ghcr.io/dvflw/mantle-playwright-python:${VERSION}" |
| 33 | + if [[ "${VERSION}" != *-* ]]; then |
| 34 | + NODE_TAGS="${NODE_TAGS}"$'\n'"ghcr.io/dvflw/mantle-playwright-node:latest" |
| 35 | + PY_TAGS="${PY_TAGS}"$'\n'"ghcr.io/dvflw/mantle-playwright-python:latest" |
| 36 | + fi |
| 37 | + echo "node_tags<<EOF" >> "$GITHUB_OUTPUT" |
| 38 | + echo "${NODE_TAGS}" >> "$GITHUB_OUTPUT" |
| 39 | + echo "EOF" >> "$GITHUB_OUTPUT" |
| 40 | + echo "python_tags<<EOF" >> "$GITHUB_OUTPUT" |
| 41 | + echo "${PY_TAGS}" >> "$GITHUB_OUTPUT" |
| 42 | + echo "EOF" >> "$GITHUB_OUTPUT" |
| 43 | +
|
| 44 | + - name: Set up QEMU |
| 45 | + uses: docker/setup-qemu-action@v3 |
| 46 | + |
| 47 | + - name: Set up Docker Buildx |
| 48 | + uses: docker/setup-buildx-action@v3 |
| 49 | + |
| 50 | + - name: Log in to GHCR |
| 51 | + uses: docker/login-action@v3 |
| 52 | + with: |
| 53 | + registry: ghcr.io |
| 54 | + username: ${{ github.actor }} |
| 55 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + |
| 57 | + - name: Build and push Node image |
| 58 | + uses: docker/build-push-action@v6 |
| 59 | + with: |
| 60 | + context: packages/playwright/ |
| 61 | + file: packages/playwright/Dockerfile.node |
| 62 | + platforms: linux/amd64,linux/arm64 |
| 63 | + push: true |
| 64 | + build-args: | |
| 65 | + PLAYWRIGHT_VERSION=${{ steps.version.outputs.playwright_version }} |
| 66 | + tags: ${{ steps.tags.outputs.node_tags }} |
| 67 | + |
| 68 | + - name: Build and push Python image |
| 69 | + uses: docker/build-push-action@v6 |
| 70 | + with: |
| 71 | + context: packages/playwright/ |
| 72 | + file: packages/playwright/Dockerfile.python |
| 73 | + platforms: linux/amd64,linux/arm64 |
| 74 | + push: true |
| 75 | + build-args: | |
| 76 | + PLAYWRIGHT_VERSION=${{ steps.version.outputs.playwright_version }} |
| 77 | + tags: ${{ steps.tags.outputs.python_tags }} |
| 78 | + |
| 79 | + - name: Smoke-test Node image |
| 80 | + run: | |
| 81 | + docker run --rm \ |
| 82 | + ghcr.io/dvflw/mantle-playwright-node:${{ steps.version.outputs.playwright_version }} \ |
| 83 | + node -e "require('playwright'); console.log('ok')" |
| 84 | +
|
| 85 | + - name: Smoke-test Python image |
| 86 | + run: | |
| 87 | + docker run --rm \ |
| 88 | + ghcr.io/dvflw/mantle-playwright-python:${{ steps.version.outputs.playwright_version }} \ |
| 89 | + python3 -c "import playwright; print('ok')" |
0 commit comments