2023-07-25 09:00:49 -04:00
|
|
|
name: Build bazel dev container
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- "main"
|
|
|
|
paths:
|
|
|
|
- "bazel/container/**"
|
2023-07-26 06:18:07 -04:00
|
|
|
- ".github/workflows/build-bazel-container.yml"
|
2023-07-25 09:00:49 -04:00
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-container:
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-10-11 07:49:50 -04:00
|
|
|
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
|
2023-07-25 09:00:49 -04:00
|
|
|
|
|
|
|
- name: Determine version
|
|
|
|
id: version
|
|
|
|
working-directory: ./bazel/container
|
|
|
|
run: |
|
|
|
|
version=$(grep "ARG BAZEL_VERSION" Containerfile | cut -d= -f2)
|
2023-07-26 06:18:07 -04:00
|
|
|
echo "version=v${version}" | tee -a "$GITHUB_OUTPUT"
|
2023-07-25 09:00:49 -04:00
|
|
|
|
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
2023-10-26 02:19:55 -04:00
|
|
|
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
|
2023-07-25 09:00:49 -04:00
|
|
|
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
|
2023-11-02 05:13:14 -04:00
|
|
|
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
|
2023-07-25 09:00:49 -04:00
|
|
|
with:
|
|
|
|
context: ./bazel/container
|
|
|
|
file: ./bazel/container/Containerfile
|
|
|
|
push: true
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|