Skip to content

Merge pull request #1616 from FalkorDB/fix-ai-comments #178

Merge pull request #1616 from FalkorDB/fix-ai-comments

Merge pull request #1616 from FalkorDB/fix-ai-comments #178

Workflow file for this run

name: Release image to DockerHub
permissions:
contents: read
on:
workflow_dispatch:
inputs:
cypher_version:
description: 'text-to-cypher version to release'
required: true
default: 'v0.1.5'
push:
tags: ["v*.*.*"]
branches:
- main
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
cypher_version: ${{ steps.vars.outputs.cypher_version }}
tags: ${{ steps.vars.outputs.tags }}
steps:
- name: Set up variables
id: vars
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "cypher_version=${{ github.event.inputs.cypher_version }}" >> $GITHUB_OUTPUT
else
# Get the latest released version from GitHub releases
LATEST_VERSION=$(curl -s https://api.github.com/repos/falkordb/text-to-cypher/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
echo "cypher_version=$LATEST_VERSION" >> $GITHUB_OUTPUT
fi
if [[ "${{ github.event_name }}" == "push" ]] && [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo "tags=falkordb/falkordb-browser:latest,falkordb/falkordb-browser:${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
echo "tags=falkordb/falkordb-browser:edge" >> $GITHUB_OUTPUT
fi
build-and-push:
needs: prepare
strategy:
matrix:
include:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
env:
CYPHER_VERSION: ${{ needs.prepare.outputs.cypher_version }}
BASE_TAGS: ${{ needs.prepare.outputs.tags }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Compute tags
run: |
ARCH_TAGS=$(echo "$BASE_TAGS" | awk -v arch="${{ matrix.arch }}" -F',' '{for(i=1;i<=NF;i++){printf "%s-%s", $i, arch; if(i<NF) printf ","}}')
echo "ARCH_TAGS=$ARCH_TAGS" >> $GITHUB_ENV
if [ "${{ matrix.arch }}" = "amd64" ]; then
echo "TRIVY_TAG=$(echo "$BASE_TAGS" | cut -d',' -f1)-amd64" >> $GITHUB_ENV
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Login to DockerHub
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push image
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/${{ matrix.arch }}
tags: ${{ env.ARCH_TAGS }}
build-args: |
CYPHER_VERSION=${{ env.CYPHER_VERSION }}
- name: Run Trivy vulnerability scanner
if: matrix.arch == 'amd64'
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1
with:
image-ref: ${{ env.TRIVY_TAG }}
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'HIGH,CRITICAL'
version: 'v0.69.2'
publish-manifest:
needs: [build-and-push, prepare]
runs-on: ubuntu-latest
env:
BASE_TAGS: ${{ needs.prepare.outputs.tags }}
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Login to DockerHub
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create and push manifest list
run: |
IFS=',' read -ra TAGS <<< "$BASE_TAGS"
for TAG in "${TAGS[@]}"; do
docker buildx imagetools create -t "$TAG" "${TAG}-amd64" "${TAG}-arm64"
done