-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
15ea67f
commit ee88f71
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |