Update .forgejo/workflows/build-placement.yml
Some checks failed
Build / build (push) Failing after 12s

This commit is contained in:
Warunee Tamkoo 2025-09-16 17:45:04 +07:00
parent 7254b1ed87
commit 063e54c4e0

View file

@ -6,6 +6,12 @@ on:
- "placement-dev[0-9]+.[0-9]+.[0-9]+" - "placement-dev[0-9]+.[0-9]+.[0-9]+"
- "placement-dev[0-9]+.[0-9]+.[0-9]+*" - "placement-dev[0-9]+.[0-9]+.[0-9]+*"
workflow_dispatch: workflow_dispatch:
inputs:
version:
description: "Version to deploy"
type: string
required: false
default: "latest"
env: env:
REGISTRY: ${{ vars.CONTAINER_REGISTRY }} REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
@ -30,11 +36,7 @@ jobs:
ca=["/etc/ssl/certs/ca-certificates.crt"] ca=["/etc/ssl/certs/ca-certificates.crt"]
- name: Tag Version - name: Tag Version
run: | run: |
if [[ "${{ github.event_name }}" == "push" ]]; then echo "IMAGE_VERSION=${{ inputs.version }}"
echo "IMAGE_VERSION=${{ github.ref_name }}" | sed 's/placement-dev//g' >> $GITHUB_ENV
else
echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV
fi
- name: Login in to registry - name: Login in to registry
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
@ -47,7 +49,7 @@ jobs:
platforms: linux/amd64 platforms: linux/amd64
context: . context: .
file: ./BMA.EHR.Placement.Service/Dockerfile file: ./BMA.EHR.Placement.Service/Dockerfile
tags: ${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}/hrms-api-placement:${{ env.IMAGE_VERSION }} tags: ${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}/hrms-api-placement:${{ inputs.version }}
push: true push: true
- name: Remote Deploy - name: Remote Deploy
uses: appleboy/ssh-action@v1.2.1 uses: appleboy/ssh-action@v1.2.1
@ -58,7 +60,7 @@ jobs:
password: ${{ secrets.SSH_DEPLOY_PASSWORD }} password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
script: | script: |
cd ~/repo cd ~/repo
./replace-env.sh API_PLACEMENT "${{ env.IMAGE_VERSION }}" ./replace-env.sh API_PLACEMENT "${{ inputs.version }}"
./deploy.sh ${{ env.SERVICE_NAME }} ./deploy.sh ${{ env.SERVICE_NAME }}
- name: Discord Notification - name: Discord Notification
@ -72,7 +74,7 @@ jobs:
-d "{ -d "{
\"embeds\": [{ \"embeds\": [{
\"title\": \"$STATUS\", \"title\": \"$STATUS\",
\"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ github.actor }}\`\", \"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}\`\\n- Version: \`${{ inputs.version }}\`\\n- By: \`${{ github.actor }}\`\",
\"color\": $COLOR, \"color\": $COLOR,
\"footer\": { \"footer\": {
\"text\": \"Release Notification\", \"text\": \"Release Notification\",