mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-12-02 23:02:35 -08:00
80 lines
2.2 KiB
YAML
80 lines
2.2 KiB
YAML
# Github actions workflow which builds docker images.
|
|
|
|
name: Build Docker Images
|
|
|
|
on:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- 'matrix-tools-*'
|
|
|
|
env:
|
|
DOCKER_REGISTRY: ghcr.io/element-hq
|
|
BAKE_TARGET: matrix-tools
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
jobs:
|
|
# Build our application docker images in parallel.
|
|
docker-build-and-push:
|
|
name: Build matrix-tools container image
|
|
|
|
runs-on: dind-m
|
|
steps:
|
|
- name: Inspect Builder
|
|
run: docker buildx inspect
|
|
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Get Release Tag
|
|
if: github.ref_type == 'tag' # Only for GitHub releases
|
|
run: |
|
|
echo "VERSION=${GITHUB_REF#refs/matrix-tools-*/}" >> $GITHUB_ENV
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@master
|
|
with:
|
|
images: |
|
|
${{ env.DOCKER_REGISTRY }}/${{ env.BAKE_TARGET }}
|
|
flavor: |
|
|
latest=false
|
|
tags: |
|
|
type=raw,value=${{ env.VERSION }},enable=${{ github.ref_type == 'tag' }}
|
|
type=sha,prefix=sha-,format=short
|
|
|
|
- name: Build and Push Image
|
|
id: build_image
|
|
uses: docker/[email protected]
|
|
with:
|
|
# Only for main branch or releases
|
|
push: "${{ github.ref_type == 'tag' }}"
|
|
files: |
|
|
docker-bake.hcl
|
|
${{ steps.meta.outputs.bake-file }}
|
|
targets: |
|
|
${{ env.BAKE_TARGET }}
|
|
# Override the docker bake target with Bakefile options specific to
|
|
# releasing the docker images.
|
|
#
|
|
# All options: https://docs.docker.com/reference/cli/docker/buildx/bake/#set
|
|
# Option descriptions: https://docs.docker.com/build/bake/reference/
|
|
#
|
|
# note: "base" is the target called "base".
|
|
set: |
|
|
base.output=type=image,push=true
|
|
${{ env.BAKE_TARGET }}.args.RELEASE_MODE=true
|