diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b752e94..41cf22b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,17 +1,10 @@ name: release - run-name: release ${{ github.actor }} - on: push: tags: - "v[0-9]+.[0-9]+.[0-9]+*" workflow_dispatch: - inputs: - IMAGE_VER: - description: image version - type: string - env: REGISTRY: docker.frappet.com IMAGE_NAME: edm/core @@ -79,3 +72,40 @@ jobs: 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 }} diff --git a/Services/server/src/rabbitmq/handler.ts b/Services/server/src/rabbitmq/handler.ts index e6f3aa6..309f61a 100644 --- a/Services/server/src/rabbitmq/handler.ts +++ b/Services/server/src/rabbitmq/handler.ts @@ -44,7 +44,10 @@ export async function handler(key: string, event: string): Promise { try { const stat = await minioClient.statObject(bucket, pathname); cachedMetadata[key] = { size: stat.size, type: stat.metaData["content-type"] }; - if (stat.size > 1024 * 1024 * 100) cachedBuffer[key] = Buffer.from([]); + if (stat.size > 1024 * 1024 * 100) { + console.warn("[AMQ] File is too large. Data extract will be skipped."); + cachedBuffer[key] = Buffer.from([]); + } } catch (e: any) { if (e.code === "NoSuchKey") { console.info(`[AMQ] Key: ${key} received but cannot be found.`); @@ -151,7 +154,7 @@ async function handleNotFoundRecord( if (!errorKey.includes(key)) { try { - Buffer.from(buffer).toString("base64"); + base64 = Buffer.from(buffer).toString("base64"); } catch (e) { console.warn("[WARN] Cannot extract data from the file.", e); } @@ -214,7 +217,7 @@ async function handleFoundRecord( if (!errorKey.includes(key)) { try { - Buffer.from(buffer).toString("base64"); + base64 = Buffer.from(buffer).toString("base64"); } catch (e) { console.warn("[WARN] Cannot extract data from the file.", e); }