Skip to content

Publish Snapshot Image #93

Publish Snapshot Image

Publish Snapshot Image #93

name: Publish Snapshot Image
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
branch:
description: 'list of branches to publish (JSON)'
required: true
# keep in sync with default value of strategy matrix 'branch'
default: '["main"]'
jobs:
publish-snapshot-image:
if: ${{ startsWith(github.repository, 'apache/') }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# keep in sync with default value of workflow_dispatch input 'branch'
branch: ${{ fromJSON( inputs.branch || '["main"]' ) }}
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
- name: Build and push
uses: docker/build-push-action@v6
with:
# build cache on Github Actions, See: https://docs.docker.com/build/cache/backends/gha/#using-dockerbuild-push-action
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
file: build-tools/docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: apache/spark-kubernetes-operator:main-snapshot