Skip to content

Publish Docker Images #6

Publish Docker Images

Publish Docker Images #6

name: Publish Docker Images
on:
push:
branches:
- develop
paths:
- 'codegen/Dockerfile'
- 'codegen/library.lock'
- 'tests/backstop/Dockerfile'
- 'tests/playwright/docker/wordpress/Dockerfile'
- '.github/workflows/publish-docker-images.yml'
schedule:
# This cron job is used to build WordPress:nightly image only. All other images
# ignore this schedule.
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
image:
description: Docker image to publish
required: true
default: all
type: choice
options:
- all
- codegen
- vrt
- playwright-wp
permissions:
contents: read
packages: write
jobs:
changes:
name: Detect Changed Files
runs-on: ubuntu-latest
outputs:
codegen: ${{ steps.filter.outputs.codegen }}
vrt: ${{ steps.filter.outputs.vrt }}
playwright-wp: ${{ steps.filter.outputs.playwright-wp }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Detect changed paths
uses: dorny/paths-filter@v4
id: filter
with:
filters: |
codegen:
- 'codegen/Dockerfile'
- 'codegen/library.lock'
- '.github/workflows/publish-docker-images.yml'
vrt:
- 'tests/backstop/Dockerfile'
- '.github/workflows/publish-docker-images.yml'
playwright-wp:
- 'tests/playwright/docker/wordpress/Dockerfile'
- '.github/workflows/publish-docker-images.yml'
publish-codegen:
name: Codegen
runs-on: ubuntu-latest
needs: changes
if: |
needs.changes.outputs.codegen == 'true' ||
(github.event_name == 'workflow_dispatch' && (github.event.inputs.image == 'all' || github.event.inputs.image == 'codegen'))
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Load codegen library version
id: library_version
run: |
LIBRARY_SHA=$(cat codegen/library.lock)
echo "sha=$LIBRARY_SHA" >> "$GITHUB_OUTPUT"
- name: Build and push Docker image
uses: ./.github/actions/build-push-docker-image
with:
build-args: |
LIBRARY_SHA=${{ steps.library_version.outputs.sha }}
tags: ghcr.io/google/site-kit-wp/codegen:${{ steps.library_version.outputs.sha }}
context: codegen
labels: org.opencontainers.image.description=Docker image used to run code generation for Site Kit.
registry-username: "github-actions[bot]"
registry-password: ${{ secrets.GITHUB_TOKEN }}
publish-vrt:
name: Backstop
runs-on: ubuntu-latest
needs: changes
if: |
needs.changes.outputs.vrt == 'true' ||
(github.event_name == 'workflow_dispatch' && (github.event.inputs.image == 'all' || github.event.inputs.image == 'vrt'))
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Build and push Docker image
uses: ./.github/actions/build-push-docker-image
with:
# Update the version number here when updating the Backstop version within the Dockerfile.
tags: ghcr.io/google/site-kit-wp/vrt:6.3.25-node22-chrome146.0.7680.80
context: ./tests/backstop
labels: org.opencontainers.image.description=Docker image used to run visual regression tests for Site Kit.
registry-username: "github-actions[bot]"
registry-password: ${{ secrets.GITHUB_TOKEN }}
publish-playwright-wp-fixed:
name: Playwright WP 5.2.21
runs-on: ubuntu-latest
needs: changes
if: |
needs.changes.outputs.playwright-wp == 'true' ||
(github.event_name == 'workflow_dispatch' && (github.event.inputs.image == 'all' || github.event.inputs.image == 'playwright-wp'))
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Build and push Docker image
uses: ./.github/actions/build-push-docker-image
with:
context: tests/playwright/docker/wordpress
tags: ghcr.io/google/site-kit-wp/playwright-wp:5.2.21
build-args: WP_VERSION=5.2.21
labels: org.opencontainers.image.description=WordPress 5.2.21 Docker image for Site Kit Playwright tests.
registry-username: "github-actions[bot]"
registry-password: ${{ secrets.GITHUB_TOKEN }}
publish-playwright-wp-latest:
name: Playwright WP latest
runs-on: ubuntu-latest
needs: changes
if: |
needs.changes.outputs.playwright-wp == 'true' ||
(github.event_name == 'workflow_dispatch' && (github.event.inputs.image == 'all' || github.event.inputs.image == 'playwright-wp'))
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Resolve latest WordPress version
id: wp_version
run: |
VERSION=$(curl -fsSL https://api.wordpress.org/core/version-check/1.7/ | jq -r '.offers[0].version')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Build and push Docker image
uses: ./.github/actions/build-push-docker-image
with:
context: tests/playwright/docker/wordpress
tags: |
ghcr.io/google/site-kit-wp/playwright-wp:${{ steps.wp_version.outputs.version }}
ghcr.io/google/site-kit-wp/playwright-wp:latest
build-args: WP_VERSION=latest
skip-if-exists-tag: ghcr.io/google/site-kit-wp/playwright-wp:${{ steps.wp_version.outputs.version }}
labels: org.opencontainers.image.description=WordPress latest Docker image for Site Kit Playwright tests.
registry-username: "github-actions[bot]"
registry-password: ${{ secrets.GITHUB_TOKEN }}
publish-playwright-wp-nightly:
name: Playwright WP nightly
runs-on: ubuntu-latest
needs: changes
if: |
needs.changes.outputs.playwright-wp == 'true' ||
github.event_name == 'schedule' ||
(github.event_name == 'workflow_dispatch' && (github.event.inputs.image == 'all' || github.event.inputs.image == 'playwright-wp'))
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Build and push Docker image
uses: ./.github/actions/build-push-docker-image
with:
context: tests/playwright/docker/wordpress
tags: ghcr.io/google/site-kit-wp/playwright-wp:nightly
build-args: WP_VERSION=nightly
labels: org.opencontainers.image.description=WordPress nightly Docker image for Site Kit Playwright tests.
registry-username: "github-actions[bot]"
registry-password: ${{ secrets.GITHUB_TOKEN }}