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