constellation/.github/workflows/build-bazel-container.yml

58 lines
1.8 KiB
YAML
Raw Normal View History

name: Build bazel dev container
on:
push:
branches:
- "main"
paths:
- "bazel/container/**"
- ".github/workflows/build-bazel-container.yml"
workflow_dispatch:
jobs:
build-container:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Determine version
id: version
working-directory: ./bazel/container
run: |
version=$(grep "ARG BAZEL_VERSION" Containerfile | cut -d= -f2)
echo "version=v${version}" | tee -a "$GITHUB_OUTPUT"
- name: Docker meta
id: meta
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0
with:
images: |
ghcr.io/edgelesssys/bazel-container
flavor: |
latest=false
tags: |
type=raw,value=${{ steps.version.outputs.version }},enable=${{ github.ref_name == 'main' }}
type=raw,value=${{ github.ref_name }},enable=${{ github.ref_name != 'main' }}
type=sha,value=${{ github.sha }}
type=raw,value=latest,enable=${{ github.ref_name == 'main' }}
- name: Log in to the Container registry
uses: ./.github/actions/container_registry_login
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push container image
uses: docker/build-push-action@0a97817b6ade9f46837855d676c4cca3a2471fc9 # v4.2.1
with:
context: ./bazel/container
file: ./bazel/container/Containerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}