Skip to content

perf: improve performance of IsGrandChildOf (#188) #47

perf: improve performance of IsGrandChildOf (#188)

perf: improve performance of IsGrandChildOf (#188) #47

Workflow file for this run

# Copyright 2023 Anass Bouassaba, Piotr Łoboda.
#
# Use of this software is governed by the Business Source License
# included in the file licenses/BSL.txt.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the GNU Affero General Public License v3.0 only, included in the file
# licenses/AGPL.txt.
name: Build and Push voltaserve/api
on:
workflow_dispatch:
inputs:
branch:
required: false
default: ""
type: string
description: Override code checkout branch (e.g. "feature/branch")
push:
branches:
- main
paths:
- "api/**"
tags:
- 'v*'
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Prepare input branch
if: ${{ github.event.inputs.branch != '' }}
run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_ENV
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ env.branch || github.ref }}
- name: Set Up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64, amd64
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create tag list matching semver from executing tag
if: ${{ github.ref_type == 'tag' }}
run: |
name="voltaserve/api"
version="${{ github.ref_name }}"
version="${version#v}"
IFS='.' read -r -a parts <<< "$version"
TAGS="$name:$version"
for ((i=${#parts[@]}-1; i>0; i--)); do
tag=$(IFS='.'; echo "${parts[*]:0:$i}")
TAGS+=",$name:$tag"
done
TAGS+=",$name:latest"
echo "TAGS=$TAGS" >> $GITHUB_ENV
- name: Set the tag on workflow dispatch
if: ${{ github.ref_type != 'tag' }}
run: echo "TAGS=voltaserve/api:$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: ./api
push: true
tags: ${{ env.TAGS }}
platforms: linux/amd64,linux/arm64