Files
documentdb/.github/workflows/build_containers.yml
T

66 lines
1.7 KiB
YAML

name: Build heliodb Containers
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- 'main'
paths:
- '.github/containers/**'
- '.github/workflows/build_containers.yml'
pull_request:
types: [opened, reopened, synchronize]
branches:
- 'main'
paths:
- '.github/containers/**'
- '.github/workflows/build_containers.yml'
workflow_dispatch:
inputs:
pushLatestTag:
description: 'Publish latest tag'
default: false
type: boolean
env:
tagBranchName: ${{ github.event.pull_request && 'private' || github.ref_name }}
jobs:
ubuntu_build_container:
runs-on: ubuntu-latest
steps:
- name: Set tag name
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/microsoft/heliodb/build_ubuntu
tags: |
${{ (github.event_name == 'push' || inputs.pushLatestTag == true) && 'type=raw,value={{branch}}_latest' || 'type=raw,value={{branch}}_{{sha}}' }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: '{{ defaultContext }}'
file: '.github/containers/Build-Ubuntu/Dockerfile'
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max