Move bigquery-emulator to DataBiosphere (DataBiosphere/azul#5905) #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build and push image | ||
on: | ||
push: | ||
branches: | ||
- main | ||
# TODO: remove pull_request | ||
pull_request: | ||
env: | ||
# The fully qualified image name of the image to build. The first component is | ||
# the host name of the registry that primarily hosts the image. | ||
# | ||
azul_docker_bigquery_emulator_image: docker.io/ucscgi/azul-bigquery-emulator | ||
# An optional prefix for the image name if the image is to be pushed to an | ||
# alternate registry instead of the one noted in the image name above. | ||
# | ||
azul_docker_registry: "" | ||
# The tag from the upstream repo that this repo is forked from. | ||
# | ||
azul_docker_bigquery_emulator_upstream_version: 0.4.4 | ||
# The version of this image. The image will be tagged with the version of the | ||
# upstream image followed by the value of this variable. Increment this value | ||
# to update the OS packages installed in the image. | ||
# | ||
azul_docker_bigquery_emulator_internal_version: 1 | ||
jobs: | ||
build-image: | ||
env: | ||
version: "${{ format( | ||
Check failure on line 33 in .github/workflows/build.yml
|
||
'{2}-{3}', | ||
env.azul_docker_bigquery_emulator_upstream_version, | ||
env.azul_docker_bigquery_emulator_internal_version | ||
) }}" | ||
cache_from_registry: "${{ format( | ||
'type=registry,ref={0}{1}_buildcache', | ||
env.azul_docker_registry, | ||
env.azul_docker_bigquery_emulator_image | ||
) }}" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
# To facilitate local builds using the Makefile | ||
driver-opts: ${{ startsWith(env.azul_docker_registry, 'localhost:') && 'network=host' || '' }} | ||
- name: cache for linux | ||
uses: actions/cache@v3 | ||
if: runner.os == 'Linux' | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Log into registry | ||
# TODO: remove pull_request | ||
if: > | ||
github.event_name != 'pull_request' | ||
&& vars.AZUL_DOCKER_REGISTRY_USER | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ vars.AZUL_DOCKER_REGISTRY_USER }} | ||
password: ${{ secrets.AZUL_DOCKER_REGISTRY_PASSWORD }} | ||
- name: Build and conditionally push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
build-args: | | ||
azul_docker_bigquery_emulator_base_image_tag=${{ env.azul_docker_bigquery_emulator_base_image_tag }} | ||
azul_docker_bigquery_emulator_internal_version=${{ env.azul_docker_bigquery_emulator_internal_version }} | ||
VERSION=${{ env.version }} | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
# TODO: remove pull_request | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: "${{ format( | ||
'{0}{1}:{2}', | ||
env.azul_docker_registry, | ||
env.azul_docker_bigquery_emulator_image, | ||
env.version | ||
) }}" | ||
cache-from: | | ||
type=local,src=~/.cache/go-build | ||
${{ env.cache_from_registry }} | ||
cache-to: "${{ format( | ||
'type=registry,ref={0}{1}_buildcache,mode=max', | ||
env.azul_docker_registry, | ||
env.azul_docker_bigquery_emulator_image | ||
) }}" |