Skip to content

Commit 3d97646

Browse files
committed
devops: push Docker image to MCR
1 parent f1c8344 commit 3d97646

File tree

4 files changed

+87
-5
lines changed

4 files changed

+87
-5
lines changed

.github/workflows/publish.yml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
release:
44
types: [published]
55
jobs:
6-
deploy:
6+
deploy-pypi:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v2
@@ -28,3 +28,41 @@ jobs:
2828
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
2929
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
3030
run: twine upload dist/*
31+
publish-docker:
32+
name: "publish to DockerHub"
33+
# We use `docker push --all-tags` to push all tags which is a newly addition to docker
34+
runs-on: ubuntu-20.04
35+
if: github.repository == 'microsoft/playwright-python'
36+
steps:
37+
- uses: actions/checkout@v2
38+
- uses: azure/docker-login@v1
39+
with:
40+
login-server: playwright.azurecr.io
41+
username: playwright
42+
password: ${{ secrets.DOCKER_PASSWORD }}
43+
- uses: microsoft/playwright-github-action@v1
44+
- name: Set up Python
45+
uses: actions/setup-python@v2
46+
with:
47+
python-version: 3.8
48+
- name: Install dependencies
49+
run: |
50+
python -m pip install --upgrade pip
51+
pip install -r local-requirements.txt
52+
pip install -e .
53+
- name: Build package
54+
run: python build_package.py
55+
- name: Install
56+
run: python -m playwright install
57+
- name: Build Docker image
58+
run: docker build -t playwright-python:localbuild .
59+
- name: tag & publish
60+
run: |
61+
# GITHUB_REF has a form of `refs/tags/v1.3.0`.
62+
# TAG_NAME would be `v1.3.0`
63+
TAG_NAME=${GITHUB_REF#refs/tags/}
64+
./scripts/tag_image_and_push.sh playwright-python:localbuild playwright.azurecr.io/public/playwright:latest
65+
./scripts/tag_image_and_push.sh playwright-python:localbuild playwright.azurecr.io/public/playwright:${TAG_NAME}
66+
67+
./scripts/tag_image_and_push.sh playwright-python:localbuild playwright.azurecr.io/public/playwright-python:focal
68+
./scripts/tag_image_and_push.sh playwright:localbuild-focal playwright.azurecr.io/public/playwright:${TAG_NAME}-focal
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "devrelease:docker"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- release-*
8+
paths:
9+
- .github/workflows/publish_canary_docker.yml
10+
11+
jobs:
12+
publish-canary-docker:
13+
name: "publish to DockerHub"
14+
# We use `docker push --all-tags` to push all tags which is a newly addition to docker
15+
runs-on: ubuntu-20.04
16+
if: github.repository == 'microsoft/playwright-python'
17+
steps:
18+
- uses: actions/checkout@v2
19+
- uses: azure/docker-login@v1
20+
with:
21+
login-server: playwright.azurecr.io
22+
username: playwright
23+
password: ${{ secrets.DOCKER_PASSWORD }}
24+
- uses: microsoft/playwright-github-action@v1
25+
- name: Set up Python
26+
uses: actions/setup-python@v2
27+
with:
28+
python-version: 3.8
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install -r local-requirements.txt
33+
pip install -e .
34+
- name: Build package
35+
run: python build_package.py
36+
- name: Install
37+
run: python -m playwright install
38+
- run: docker build -t playwright-python:localbuild .
39+
- name: tag & publish
40+
run: |
41+
./scripts/tag_image_and_push.sh playwright-python:localbuild playwright.azurecr.io/public/playwright-python:next
42+
./scripts/tag_image_and_push.sh playwright-python:localbuild playwright.azurecr.io/public/playwright-python:next-focal
43+
./scripts/tag_image_and_push.sh playwright-python:localbuild playwright.azurecr.io/public/playwright-python:sha-${{ github.sha }}

.github/workflows/test_docker.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ jobs:
1818
runs-on: ubuntu-20.04
1919
steps:
2020
- uses: actions/checkout@v2
21-
- name: Set up Node.js
22-
uses: actions/setup-node@v1
23-
with:
24-
node-version: 12.x
2521
- name: Set up Python
2622
uses: actions/setup-python@v2
2723
with:

scripts/tag_image_and_push.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
echo "-- tagging: $2"
4+
docker tag $1 $2
5+
docker push $2

0 commit comments

Comments
 (0)