Skip to content

Commit

Permalink
ci: simplify image build
Browse files Browse the repository at this point in the history
  • Loading branch information
ygrishajev committed Dec 9, 2024
1 parent 15ea67f commit ee88f71
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build Image

on:
workflow_dispatch:
workflow_call:
inputs:
tag:
description: 'Tag to build'
required: true
type: string
registry:
description: 'Registry to push to'
required: true
type: string

concurrency:
group: ${{ github.workflow }}

jobs:
build:
name: Build Docker image
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker image
run: |
tag=${{ github.event.inputs.tag }}
force_build=""
if [[ "$tag" == console-api/* ]]; then
app="api"
elif [[ "$tag" == console-web/* ]]; then
app="deploy-web"
force_build="-f"
else
echo "Error: Unknown tag format"
exit 1
fi
tag="${tag#*/}"
tag="${tag#v}"
./packages/docker/script/build.sh -r ${{ github.event.inputs.registry }} -t $tag -a $app $force_build

0 comments on commit ee88f71

Please sign in to comment.