Files
ess-helm/.github/workflows/matrix-tools.yml
T

105 lines
2.7 KiB
YAML

# Copyright 2025 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
name: Build matrix-tool Docker Images
on:
pull_request_target:
workflow_dispatch:
push:
branches:
- main
tags:
- 'matrix-tools-*'
env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}/matrix-tools
permissions:
contents: read
packages: read
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-go@v5
with:
go-version: stable
- uses: golangci/golangci-lint-action@v6
with:
working-directory: matrix-tools
args: -v --show-stats --no-config --modules-download-mode readonly --timeout 5m
- uses: GoTestTools/gotestfmt-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
run: cd matrix-tools && go test -v -json ./... 2>&1 | gotestfmt
# Build our application docker images in parallel.
docker-build-and-push:
permissions:
contents: read
packages: write
name: Build matrix-tools container image
needs:
- tests
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- 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 "Converting $GITHUB_REF to tags"
echo "VERSION=${GITHUB_REF#refs\/tags\/matrix-tools-}" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY_IMAGE }}
flavor: |
latest=false
tags: |
type=raw,value=${{ env.VERSION }},enable=${{ github.ref_type == 'tag' }}
type=sha,prefix=sha-,format=short
labels: |
org.opencontainers.image.licenses=AGPL-3.0-only OR LicenseRef-Element-Commercial
annotations: |
org.opencontainers.image.licenses=AGPL-3.0-only OR LicenseRef-Element-Commercial
- name: Build and Push Image
uses: docker/bake-action@v6
with:
push: "${{ github.ref_type == 'tag' }}"
files: |
docker-bake.hcl
cwd://${{ steps.meta.outputs.bake-file }}
targets: matrix-tools
set: |
*.output=type=image
*.platform=linux/amd64,linux/arm64