Merge pull request #16 from csaude/OF-98 #18
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
name: Publish frontend SNAPSHOT image | |
on: | |
workflow_dispatch: | |
inputs: | |
cache_bust: | |
description: "Disable esm build cache" | |
required: false | |
type: boolean | |
push: | |
branches: | |
- dev | |
paths: | |
- "build/frontend/**" | |
env: | |
FRONTEND_IMAGE_NAME: sesp/openmrs-distro-sesp-frontend | |
jobs: | |
build_push_frontend: | |
name: Build and push frontend SNAPSHOT image to C-Saúde Hub | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to the container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ secrets.REGISTRY }} | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Set VERSION environment variable | |
run: | | |
echo "VERSION=$(grep version build/backend/openmrs-distro.properties | cut -d'=' -f2)" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push frontend | |
uses: docker/build-push-action@v6 | |
with: | |
build-args: | | |
CACHE_BUST=${{ inputs.cache_bust && github.run_id || false}} | |
push: true | |
context: build/frontend | |
tags: ${{ secrets.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}:${{ env.VERSION }},${{ secrets.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}:latest | |
cache-from: type=registry,ref=${{ secrets.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}:cache | |
cache-to: type=registry,ref=${{ secrets.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}:cache,image-manifest=true |