Merge branch 'main' into development

# Conflicts:
#	.github/workflows/release.yaml
This commit is contained in:
DESKTOP-2S5P7D1\Windows 10 2024-12-19 11:19:23 +07:00
commit e9287e8dd7
2 changed files with 43 additions and 10 deletions

View file

@ -1,17 +1,10 @@
name: release name: release
run-name: release ${{ github.actor }} run-name: release ${{ github.actor }}
on: on:
push: push:
tags: tags:
- "v[0-9]+.[0-9]+.[0-9]+*" - "v[0-9]+.[0-9]+.[0-9]+*"
workflow_dispatch: workflow_dispatch:
inputs:
IMAGE_VER:
description: image version
type: string
env: env:
REGISTRY: docker.frappet.com REGISTRY: docker.frappet.com
IMAGE_NAME: edm/core IMAGE_NAME: edm/core
@ -79,3 +72,40 @@ jobs:
docker compose pull docker compose pull
docker compose up -d docker compose up -d
echo "${{ steps.gen_ver.outputs.image_ver }}"> success 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 }}

View file

@ -44,7 +44,10 @@ export async function handler(key: string, event: string): Promise<boolean> {
try { try {
const stat = await minioClient.statObject(bucket, pathname); const stat = await minioClient.statObject(bucket, pathname);
cachedMetadata[key] = { size: stat.size, type: stat.metaData["content-type"] }; 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) { } catch (e: any) {
if (e.code === "NoSuchKey") { if (e.code === "NoSuchKey") {
console.info(`[AMQ] Key: ${key} received but cannot be found.`); console.info(`[AMQ] Key: ${key} received but cannot be found.`);
@ -151,7 +154,7 @@ async function handleNotFoundRecord(
if (!errorKey.includes(key)) { if (!errorKey.includes(key)) {
try { try {
Buffer.from(buffer).toString("base64"); base64 = Buffer.from(buffer).toString("base64");
} catch (e) { } catch (e) {
console.warn("[WARN] Cannot extract data from the file.", e); console.warn("[WARN] Cannot extract data from the file.", e);
} }
@ -214,7 +217,7 @@ async function handleFoundRecord(
if (!errorKey.includes(key)) { if (!errorKey.includes(key)) {
try { try {
Buffer.from(buffer).toString("base64"); base64 = Buffer.from(buffer).toString("base64");
} catch (e) { } catch (e) {
console.warn("[WARN] Cannot extract data from the file.", e); console.warn("[WARN] Cannot extract data from the file.", e);
} }