From c87e467a6ef3bc24e1f5efd3662d9e1ad17dcab1 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Tue, 23 Dec 2025 23:32:02 +0700 Subject: [PATCH] change build to docker hub --- .../workflows/dockerhub-release-checkin.yaml | 72 +++++++ .../workflows/dockerhub-release-command.yaml | 72 +++++++ .../dockerhub-release-discipline.yaml | 72 +++++++ .../workflows/dockerhub-release-insignia.yaml | 72 +++++++ .../workflows/dockerhub-release-leave.yaml | 10 +- .../dockerhub-release-placement.yaml | 72 +++++++ .../workflows/dockerhub-release-report.yaml | 72 +++++++ .../dockerhub-release-retirement.yaml | 72 +++++++ .github/workflows/release_Retirement.yaml | 6 +- .../workflows/release_checkin_consumer.yaml | 6 +- .github/workflows/release_command.yaml | 6 +- .github/workflows/release_discipline.yaml | 6 +- .github/workflows/release_insignia.yaml | 6 +- .github/workflows/release_leave.yaml | 6 +- .github/workflows/release_placement.yaml | 6 +- .github/workflows/release_report.yaml | 196 +++++++++--------- 16 files changed, 628 insertions(+), 124 deletions(-) create mode 100644 .github/workflows/dockerhub-release-checkin.yaml create mode 100644 .github/workflows/dockerhub-release-command.yaml create mode 100644 .github/workflows/dockerhub-release-discipline.yaml create mode 100644 .github/workflows/dockerhub-release-insignia.yaml create mode 100644 .github/workflows/dockerhub-release-placement.yaml create mode 100644 .github/workflows/dockerhub-release-report.yaml create mode 100644 .github/workflows/dockerhub-release-retirement.yaml diff --git a/.github/workflows/dockerhub-release-checkin.yaml b/.github/workflows/dockerhub-release-checkin.yaml new file mode 100644 index 00000000..9e7c4e23 --- /dev/null +++ b/.github/workflows/dockerhub-release-checkin.yaml @@ -0,0 +1,72 @@ +name: DockerHub Release - CheckIn Consumer +run-name: DockerHub Release - CheckIn Consumer by ${{ github.actor }} +on: + push: + tags: + - "checkin-[0-9]+.[0-9]+.[0-9]+" + workflow_dispatch: + inputs: + IMAGE_VER: + description: "Image version (e.g., latest, v1.0.0)" + required: false + default: "latest" + +env: + DOCKERHUB_REGISTRY: docker.io + IMAGE_NAME: hrms-api-checkin + +jobs: + release-to-dockerhub: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set output tags + id: vars + run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT + + - name: Generate version + id: gen_ver + run: | + if [[ $GITHUB_REF == 'refs/tags/'* ]]; then + IMAGE_VER=${{ steps.vars.outputs.tag }} + else + IMAGE_VER=${{ github.event.inputs.IMAGE_VER }} + fi + if [[ $IMAGE_VER == '' ]]; then + IMAGE_VER='test-vBeta' + fi + echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT + echo "Generated version: ${IMAGE_VER}" + + - name: Display version + run: | + echo "Git Ref: $GITHUB_REF" + echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: ${{env.DOCKERHUB_REGISTRY}} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: BMA.EHR.CheckInConsumer/Dockerfile + platforms: linux/amd64 + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }} + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest + labels: | + org.opencontainers.image.title=BMA EHR CheckIn Consumer + org.opencontainers.image.description=HRMS CheckIn Consumer Service + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/dockerhub-release-command.yaml b/.github/workflows/dockerhub-release-command.yaml new file mode 100644 index 00000000..33d6b330 --- /dev/null +++ b/.github/workflows/dockerhub-release-command.yaml @@ -0,0 +1,72 @@ +name: DockerHub Release - Command Service +run-name: DockerHub Release - Command Service by ${{ github.actor }} +on: + push: + tags: + - "command-[0-9]+.[0-9]+.[0-9]+" + workflow_dispatch: + inputs: + IMAGE_VER: + description: "Image version (e.g., latest, v1.0.0)" + required: false + default: "latest" + +env: + DOCKERHUB_REGISTRY: docker.io + IMAGE_NAME: hrms-api-command + +jobs: + release-to-dockerhub: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set output tags + id: vars + run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT + + - name: Generate version + id: gen_ver + run: | + if [[ $GITHUB_REF == 'refs/tags/'* ]]; then + IMAGE_VER=${{ steps.vars.outputs.tag }} + else + IMAGE_VER=${{ github.event.inputs.IMAGE_VER }} + fi + if [[ $IMAGE_VER == '' ]]; then + IMAGE_VER='test-vBeta' + fi + echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT + echo "Generated version: ${IMAGE_VER}" + + - name: Display version + run: | + echo "Git Ref: $GITHUB_REF" + echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: ${{env.DOCKERHUB_REGISTRY}} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: BMA.EHR.Command.Service/Dockerfile + platforms: linux/amd64 + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }} + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest + labels: | + org.opencontainers.image.title=BMA EHR Command Service + org.opencontainers.image.description=HRMS Command API Service + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/dockerhub-release-discipline.yaml b/.github/workflows/dockerhub-release-discipline.yaml new file mode 100644 index 00000000..96096a54 --- /dev/null +++ b/.github/workflows/dockerhub-release-discipline.yaml @@ -0,0 +1,72 @@ +name: DockerHub Release - Discipline Service +run-name: DockerHub Release - Discipline Service by ${{ github.actor }} +on: + push: + tags: + - "discipline-[0-9]+.[0-9]+.[0-9]+" + workflow_dispatch: + inputs: + IMAGE_VER: + description: "Image version (e.g., latest, v1.0.0)" + required: false + default: "latest" + +env: + DOCKERHUB_REGISTRY: docker.io + IMAGE_NAME: hrms-api-discipline + +jobs: + release-to-dockerhub: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set output tags + id: vars + run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT + + - name: Generate version + id: gen_ver + run: | + if [[ $GITHUB_REF == 'refs/tags/'* ]]; then + IMAGE_VER=${{ steps.vars.outputs.tag }} + else + IMAGE_VER=${{ github.event.inputs.IMAGE_VER }} + fi + if [[ $IMAGE_VER == '' ]]; then + IMAGE_VER='test-vBeta' + fi + echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT + echo "Generated version: ${IMAGE_VER}" + + - name: Display version + run: | + echo "Git Ref: $GITHUB_REF" + echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: ${{env.DOCKERHUB_REGISTRY}} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: BMA.EHR.Discipline.Service/Dockerfile + platforms: linux/amd64 + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }} + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest + labels: | + org.opencontainers.image.title=BMA EHR Discipline Service + org.opencontainers.image.description=HRMS Discipline API Service + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/dockerhub-release-insignia.yaml b/.github/workflows/dockerhub-release-insignia.yaml new file mode 100644 index 00000000..81dae954 --- /dev/null +++ b/.github/workflows/dockerhub-release-insignia.yaml @@ -0,0 +1,72 @@ +name: DockerHub Release - Insignia Service +run-name: DockerHub Release - Insignia Service by ${{ github.actor }} +on: + push: + tags: + - "insignia-[0-9]+.[0-9]+.[0-9]+" + workflow_dispatch: + inputs: + IMAGE_VER: + description: "Image version (e.g., latest, v1.0.0)" + required: false + default: "latest" + +env: + DOCKERHUB_REGISTRY: docker.io + IMAGE_NAME: hrms-api-insignia + +jobs: + release-to-dockerhub: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set output tags + id: vars + run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT + + - name: Generate version + id: gen_ver + run: | + if [[ $GITHUB_REF == 'refs/tags/'* ]]; then + IMAGE_VER=${{ steps.vars.outputs.tag }} + else + IMAGE_VER=${{ github.event.inputs.IMAGE_VER }} + fi + if [[ $IMAGE_VER == '' ]]; then + IMAGE_VER='test-vBeta' + fi + echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT + echo "Generated version: ${IMAGE_VER}" + + - name: Display version + run: | + echo "Git Ref: $GITHUB_REF" + echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: ${{env.DOCKERHUB_REGISTRY}} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: BMA.EHR.Insignia/Dockerfile + platforms: linux/amd64 + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }} + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest + labels: | + org.opencontainers.image.title=BMA EHR Insignia Service + org.opencontainers.image.description=HRMS Insignia API Service + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/dockerhub-release-leave.yaml b/.github/workflows/dockerhub-release-leave.yaml index e78ce73d..b5a3afe2 100644 --- a/.github/workflows/dockerhub-release-leave.yaml +++ b/.github/workflows/dockerhub-release-leave.yaml @@ -4,15 +4,15 @@ on: push: tags: - "leave-[0-9]+.[0-9]+.[0-9]+" - branches: - - main - - develop + # branches: + # - main + # - develop workflow_dispatch: inputs: IMAGE_VER: - description: 'Image version (e.g., latest, v1.0.0)' + description: "Image version (e.g., latest, v1.0.0)" required: false - default: 'latest' + default: "latest" env: DOCKERHUB_REGISTRY: docker.io diff --git a/.github/workflows/dockerhub-release-placement.yaml b/.github/workflows/dockerhub-release-placement.yaml new file mode 100644 index 00000000..74fa4471 --- /dev/null +++ b/.github/workflows/dockerhub-release-placement.yaml @@ -0,0 +1,72 @@ +name: DockerHub Release - Placement Service +run-name: DockerHub Release - Placement Service by ${{ github.actor }} +on: + push: + tags: + - "placement-[0-9]+.[0-9]+.[0-9]+" + workflow_dispatch: + inputs: + IMAGE_VER: + description: "Image version (e.g., latest, v1.0.0)" + required: false + default: "latest" + +env: + DOCKERHUB_REGISTRY: docker.io + IMAGE_NAME: hrms-api-placement + +jobs: + release-to-dockerhub: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set output tags + id: vars + run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT + + - name: Generate version + id: gen_ver + run: | + if [[ $GITHUB_REF == 'refs/tags/'* ]]; then + IMAGE_VER=${{ steps.vars.outputs.tag }} + else + IMAGE_VER=${{ github.event.inputs.IMAGE_VER }} + fi + if [[ $IMAGE_VER == '' ]]; then + IMAGE_VER='test-vBeta' + fi + echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT + echo "Generated version: ${IMAGE_VER}" + + - name: Display version + run: | + echo "Git Ref: $GITHUB_REF" + echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: ${{env.DOCKERHUB_REGISTRY}} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: BMA.EHR.Placement.Service/Dockerfile + platforms: linux/amd64 + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }} + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest + labels: | + org.opencontainers.image.title=BMA EHR Placement Service + org.opencontainers.image.description=HRMS Placement API Service + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/dockerhub-release-report.yaml b/.github/workflows/dockerhub-release-report.yaml new file mode 100644 index 00000000..132b218b --- /dev/null +++ b/.github/workflows/dockerhub-release-report.yaml @@ -0,0 +1,72 @@ +name: DockerHub Release - Report Service +run-name: DockerHub Release - Report Service by ${{ github.actor }} +on: + push: + tags: + - "report-[0-9]+.[0-9]+.[0-9]+" + workflow_dispatch: + inputs: + IMAGE_VER: + description: "Image version (e.g., latest, v1.0.0)" + required: false + default: "latest" + +env: + DOCKERHUB_REGISTRY: docker.io + IMAGE_NAME: hrms-api-report + +jobs: + release-to-dockerhub: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set output tags + id: vars + run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT + + - name: Generate version + id: gen_ver + run: | + if [[ $GITHUB_REF == 'refs/tags/'* ]]; then + IMAGE_VER=${{ steps.vars.outputs.tag }} + else + IMAGE_VER=${{ github.event.inputs.IMAGE_VER }} + fi + if [[ $IMAGE_VER == '' ]]; then + IMAGE_VER='test-vBeta' + fi + echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT + echo "Generated version: ${IMAGE_VER}" + + - name: Display version + run: | + echo "Git Ref: $GITHUB_REF" + echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: ${{env.DOCKERHUB_REGISTRY}} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: BMA.EHR.Report.Service/Dockerfile + platforms: linux/amd64 + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }} + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest + labels: | + org.opencontainers.image.title=BMA EHR Report Service + org.opencontainers.image.description=HRMS Report API Service + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/dockerhub-release-retirement.yaml b/.github/workflows/dockerhub-release-retirement.yaml new file mode 100644 index 00000000..38e107e6 --- /dev/null +++ b/.github/workflows/dockerhub-release-retirement.yaml @@ -0,0 +1,72 @@ +name: DockerHub Release - Retirement Service +run-name: DockerHub Release - Retirement Service by ${{ github.actor }} +on: + push: + tags: + - "retirement-[0-9]+.[0-9]+.[0-9]+" + workflow_dispatch: + inputs: + IMAGE_VER: + description: "Image version (e.g., latest, v1.0.0)" + required: false + default: "latest" + +env: + DOCKERHUB_REGISTRY: docker.io + IMAGE_NAME: hrms-api-retirement + +jobs: + release-to-dockerhub: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set output tags + id: vars + run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT + + - name: Generate version + id: gen_ver + run: | + if [[ $GITHUB_REF == 'refs/tags/'* ]]; then + IMAGE_VER=${{ steps.vars.outputs.tag }} + else + IMAGE_VER=${{ github.event.inputs.IMAGE_VER }} + fi + if [[ $IMAGE_VER == '' ]]; then + IMAGE_VER='test-vBeta' + fi + echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT + echo "Generated version: ${IMAGE_VER}" + + - name: Display version + run: | + echo "Git Ref: $GITHUB_REF" + echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: ${{env.DOCKERHUB_REGISTRY}} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: BMA.EHR.Retirement.Service/Dockerfile + platforms: linux/amd64 + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }} + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest + labels: | + org.opencontainers.image.title=BMA EHR Retirement Service + org.opencontainers.image.description=HRMS Retirement API Service + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/release_Retirement.yaml b/.github/workflows/release_Retirement.yaml index 6cdceae0..3fd5bedf 100644 --- a/.github/workflows/release_Retirement.yaml +++ b/.github/workflows/release_Retirement.yaml @@ -1,9 +1,9 @@ name: release-dev run-name: release-dev ${{ github.actor }} on: - push: - tags: - - "retirement-[0-9]+.[0-9]+.[0-9]+" + # push: + # tags: + # - "retirement-[0-9]+.[0-9]+.[0-9]+" workflow_dispatch: env: REGISTRY: docker.frappet.com diff --git a/.github/workflows/release_checkin_consumer.yaml b/.github/workflows/release_checkin_consumer.yaml index 31b015e6..f9081264 100644 --- a/.github/workflows/release_checkin_consumer.yaml +++ b/.github/workflows/release_checkin_consumer.yaml @@ -1,9 +1,9 @@ name: release-dev run-name: release-dev ${{ github.actor }} on: - push: - tags: - - "consumer-[0-9]+.[0-9]+.[0-9]+" + # push: + # tags: + # - "consumer-[0-9]+.[0-9]+.[0-9]+" workflow_dispatch: env: REGISTRY: docker.frappet.com diff --git a/.github/workflows/release_command.yaml b/.github/workflows/release_command.yaml index 462ed688..dba3012e 100644 --- a/.github/workflows/release_command.yaml +++ b/.github/workflows/release_command.yaml @@ -1,9 +1,9 @@ name: release-dev run-name: release-dev ${{ github.actor }} on: - push: - tags: - - "command-[0-9]+.[0-9]+.[0-9]+" + # push: + # tags: + # - "command-[0-9]+.[0-9]+.[0-9]+" workflow_dispatch: env: REGISTRY: docker.frappet.com diff --git a/.github/workflows/release_discipline.yaml b/.github/workflows/release_discipline.yaml index 0e8737f4..f4cb42da 100644 --- a/.github/workflows/release_discipline.yaml +++ b/.github/workflows/release_discipline.yaml @@ -1,9 +1,9 @@ name: release-dev run-name: release-dev ${{ github.actor }} on: - push: - tags: - - "discipline-[0-9]+.[0-9]+.[0-9]+" + # push: + # tags: + # - "discipline-[0-9]+.[0-9]+.[0-9]+" workflow_dispatch: env: REGISTRY: docker.frappet.com diff --git a/.github/workflows/release_insignia.yaml b/.github/workflows/release_insignia.yaml index 124d1e9c..af497b37 100644 --- a/.github/workflows/release_insignia.yaml +++ b/.github/workflows/release_insignia.yaml @@ -1,9 +1,9 @@ name: release-dev run-name: release-dev ${{ github.actor }} on: - push: - tags: - - "insignia-[0-9]+.[0-9]+.[0-9]+" + # push: + # tags: + # - "insignia-[0-9]+.[0-9]+.[0-9]+" workflow_dispatch: env: REGISTRY: docker.frappet.com diff --git a/.github/workflows/release_leave.yaml b/.github/workflows/release_leave.yaml index 4b361f5f..9b5e0014 100644 --- a/.github/workflows/release_leave.yaml +++ b/.github/workflows/release_leave.yaml @@ -1,9 +1,9 @@ name: release-dev run-name: release-dev ${{ github.actor }} on: - push: - tags: - - "leave-[0-9]+.[0-9]+.[0-9]+" + # push: + # tags: + # - "leave-[0-9]+.[0-9]+.[0-9]+" workflow_dispatch: env: REGISTRY: docker.frappet.com diff --git a/.github/workflows/release_placement.yaml b/.github/workflows/release_placement.yaml index d9c2f266..377cbaf4 100644 --- a/.github/workflows/release_placement.yaml +++ b/.github/workflows/release_placement.yaml @@ -1,9 +1,9 @@ name: release-dev run-name: release-dev ${{ github.actor }} on: - push: - tags: - - "placement-[0-9]+.[0-9]+.[0-9]+" + # push: + # tags: + # - "placement-[0-9]+.[0-9]+.[0-9]+" workflow_dispatch: env: REGISTRY: docker.frappet.com diff --git a/.github/workflows/release_report.yaml b/.github/workflows/release_report.yaml index 9ba5a7c4..e529729b 100644 --- a/.github/workflows/release_report.yaml +++ b/.github/workflows/release_report.yaml @@ -1,107 +1,107 @@ name: release-dev run-name: release-dev ${{ github.actor }} on: - push: - tags: - - "reportv2-[0-9]+.[0-9]+.[0-9]+" + # push: + # tags: + # - "reportv2-[0-9]+.[0-9]+.[0-9]+" workflow_dispatch: env: - REGISTRY: docker.frappet.com - IMAGE_NAME: ehr/bma-ehr-report-v2-service - DEPLOY_HOST: frappet.com - DEPLOY_PORT: 10102 - # COMPOSE_PATH: /home/frappet/docker/bma-ehr - COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-report-v2 - TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0 + REGISTRY: docker.frappet.com + IMAGE_NAME: ehr/bma-ehr-report-v2-service + DEPLOY_HOST: frappet.com + DEPLOY_PORT: 10102 + # COMPOSE_PATH: /home/frappet/docker/bma-ehr + COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-report-v2 + TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0 jobs: - # act workflow_dispatch -W .github/workflows/release_report.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357 - release-dev: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set output tags - id: vars - run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT - - name: Gen Version - id: gen_ver - run: | - if [[ $GITHUB_REF == 'refs/tags/'* ]]; then - IMAGE_VER=${{ steps.vars.outputs.tag }} - 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: Check Version - run: | - echo $GITHUB_REF - echo ${{ steps.gen_ver.outputs.image_ver }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login in to registry - uses: docker/login-action@v2 - with: - registry: ${{env.REGISTRY}} - username: ${{secrets.DOCKER_USER}} - password: ${{secrets.DOCKER_PASS}} - - name: Build and load local docker image - uses: docker/build-push-action@v3 - with: - context: . - platforms: linux/amd64 - file: BMA.EHR.Report.Service/Dockerfile - push: true - tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest + # act workflow_dispatch -W .github/workflows/release_report.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357 + release-dev: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set output tags + id: vars + run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT + - name: Gen Version + id: gen_ver + run: | + if [[ $GITHUB_REF == 'refs/tags/'* ]]; then + IMAGE_VER=${{ steps.vars.outputs.tag }} + 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: Check Version + run: | + echo $GITHUB_REF + echo ${{ steps.gen_ver.outputs.image_ver }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login in to registry + uses: docker/login-action@v2 + with: + registry: ${{env.REGISTRY}} + username: ${{secrets.DOCKER_USER}} + password: ${{secrets.DOCKER_PASS}} + - name: Build and load local docker image + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64 + file: BMA.EHR.Report.Service/Dockerfile + push: true + tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest - - name: Reload docker compose - uses: appleboy/ssh-action@v0.1.8 - with: - host: ${{env.DEPLOY_HOST}} - username: frappet - password: ${{ secrets.SSH_PASSWORD }} - port: ${{env.DEPLOY_PORT}} - script: | - cd "${{env.COMPOSE_PATH}}" - docker compose pull - docker compose up -d - echo "${{ steps.gen_ver.outputs.image_ver }}"> success - - name: Notify Discord Success - if: success() - run: | - curl -H "Content-Type: application/json" \ - -X POST \ - -d '{ - "embeds": [{ - "title": "✅ Deployment Success!", - "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`", - "color": 3066993, - "footer": { - "text": "Release Notification", - "icon_url": "https://example.com/success-icon.png" - }, - "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" - }] - }' \ - ${{ secrets.DISCORD_WEBHOOK }} + - name: Reload docker compose + uses: appleboy/ssh-action@v0.1.8 + with: + host: ${{env.DEPLOY_HOST}} + username: frappet + password: ${{ secrets.SSH_PASSWORD }} + port: ${{env.DEPLOY_PORT}} + script: | + cd "${{env.COMPOSE_PATH}}" + docker compose pull + docker compose up -d + echo "${{ steps.gen_ver.outputs.image_ver }}"> success + - name: Notify Discord Success + if: success() + run: | + curl -H "Content-Type: application/json" \ + -X POST \ + -d '{ + "embeds": [{ + "title": "✅ Deployment Success!", + "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`", + "color": 3066993, + "footer": { + "text": "Release Notification", + "icon_url": "https://example.com/success-icon.png" + }, + "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" + }] + }' \ + ${{ secrets.DISCORD_WEBHOOK }} - - name: Notify Discord Failure - if: failure() - run: | - curl -H "Content-Type: application/json" \ - -X POST \ - -d '{ - "embeds": [{ - "title": "❌ Deployment Failed!", - "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`", - "color": 15158332, - "footer": { - "text": "Release Notification", - "icon_url": "https://example.com/failure-icon.png" - }, - "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" - }] - }' \ - ${{ secrets.DISCORD_WEBHOOK }} + - name: Notify Discord Failure + if: failure() + run: | + curl -H "Content-Type: application/json" \ + -X POST \ + -d '{ + "embeds": [{ + "title": "❌ Deployment Failed!", + "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`", + "color": 15158332, + "footer": { + "text": "Release Notification", + "icon_url": "https://example.com/failure-icon.png" + }, + "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" + }] + }' \ + ${{ secrets.DISCORD_WEBHOOK }}