39 lines
No EOL
1.4 KiB
YAML
39 lines
No EOL
1.4 KiB
YAML
# use for local build with act
|
|
name: build-local
|
|
run-name: build-local ${{ github.actor }}
|
|
on:
|
|
workflow_dispatch:
|
|
env:
|
|
REGISTRY: docker.frappet.com
|
|
IMAGE_NAME: demo/bma-ehr-app
|
|
jobs:
|
|
# act workflow_dispatch -W .github/workflows/build-local.yaml --input IMAGE_VER=test-v1
|
|
build-local:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
# skip Set up QEMU because it fail on act and container
|
|
- name: Gen Version
|
|
id: gen_ver
|
|
run: |
|
|
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
|
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
|
else
|
|
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
|
fi
|
|
if [[ $IMAGE_VER == '' ]]; then
|
|
IMAGE_VER='test-vBeta'
|
|
fi
|
|
echo '::set-output name=image_ver::'$IMAGE_VER
|
|
- name: Test Version
|
|
run: |
|
|
echo $GITHUB_REF
|
|
echo ${{ steps.gen_ver.outputs.image_ver }}
|
|
|
|
- name: Build and load local docker image
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64
|
|
load: true
|
|
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest |