Compare commits

...

13 Commits

Author SHA1 Message Date
TakahashiNguyen 8d0247024d Merge pull request 'fix: better ci script' (#7) from dev-cicd into main
Release package / release (push) Failing after 4m38s
Release package / build-and-push (push) Has been skipped
Reviewed-on: #7
2026-03-29 14:15:26 +00:00
TakahashiNg 9ad66301de ci: better ci
Release package / release (push) Successful in 2m23s
Release package / build-and-push (push) Has been skipped
2026-03-29 14:12:07 +00:00
TakahashiNg 5593c4fccc fix: ci script
Release package / release (push) Failing after 4m44s
Release package / build-and-push (push) Has been skipped
2026-03-29 14:06:39 +00:00
TakahashiNg 801b804d2d fix: ci script
Release package / build-and-push (push) Has been cancelled
Release package / release (push) Has been cancelled
2026-03-29 13:56:08 +00:00
TakahashiNg 7534f41c6e fix: ci script
Release package / release (push) Failing after 25s
Release package / build-and-push (push) Has been skipped
2026-03-29 13:54:37 +00:00
TakahashiNg 2873952f10 fix: ci script
Release package / release (push) Failing after 15s
Release package / build-and-push (push) Has been skipped
2026-03-29 13:52:32 +00:00
TakahashiNg e448d5ebaf ci: better ci
Release package / release (push) Failing after 32s
Release package / build-and-push (push) Has been skipped
2026-03-27 06:37:24 +00:00
TakahashiNguyen 1c9b076316 fix: better metadata name
Release package / release (push) Failing after 5m12s
Release package / build-and-push (push) Has been skipped
Reviewed-on: #6
2026-03-27 06:24:32 +00:00
TakahashiNg 25c44755b9 chore: update
Release package / release (push) Successful in 3m2s
Release package / build-and-push (push) Has been skipped
2026-03-27 06:13:29 +00:00
TakahashiNg 3e2792931b fix: better metadata name
Release package / release (push) Successful in 2m47s
Release package / build-and-push (push) Has been skipped
Release package / deploy-via-portainer (push) Has been skipped
2026-03-27 05:52:25 +00:00
TakahashiNguyen 28990c2a4c Merge pull request 'fix: better k8s path' (#5) from dev-ci-update into main
Release package / release (push) Successful in 3m41s
Release package / build-and-push (push) Successful in 4m17s
Release package / deploy-via-portainer (push) Failing after 13s
Reviewed-on: #5
2026-03-27 05:20:02 +00:00
TakahashiNg c8d0c3838f chore: update k8s file path
Release package / release (push) Successful in 3m57s
Release package / build-and-push (push) Has been skipped
Release package / deploy-via-portainer (push) Has been skipped
2026-03-27 05:15:37 +00:00
TakahashiNg 2bba4bc441 ci: update script
Release package / release (push) Failing after 12m50s
Release package / build-and-push (push) Has been cancelled
Release package / deploy-via-portainer (push) Has been cancelled
2026-03-27 04:59:26 +00:00
3 changed files with 29 additions and 16 deletions
+23 -10
View File
@@ -17,6 +17,24 @@ jobs:
outputs:
new_version: ${{ steps.set_output.outputs.version }}
steps:
- name: Calculate and Export Target IP
run: |
# 1. Lấy IP hiện tại và tính toán IP đích (đổi octet cuối thành .1)
RUNNER_IP=$(hostname -I | awk '{print $1}')
CALCULATED_IP=$(echo $RUNNER_IP | cut -d'.' -f1-3).1
# 2. Đưa vào biến môi trường toàn cục của Job
echo "TARGET_IP=${CALCULATED_IP}" >> $GITHUB_ENV
- name: Setup SSH Key
run: |
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -p 222 -t ed25519 $TARGET_IP >> ~/.ssh/known_hosts
- uses: actions/checkout@v6
with:
fetch-depth: 0
@@ -63,21 +81,24 @@ jobs:
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Commit & Push Changes
if: always()
if: gitea.ref == 'refs/heads/main'
run: |
if [ -n "$(git status --porcelain)" ]; then
git config --global user.name "gitea-actions"
git config --global user.email "actions-user@noreply.git.demonkernel.io.vn"
git remote set-url origin ssh://git@$TARGET_IP:222/FoodSurf/backend.git
git rm -r --cached .
git add .
git commit -m "chore: release [ci skip]"
git push
fi
build-and-push:
needs: release
# if: gitea.ref == 'refs/heads/main'
if: gitea.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout code
@@ -112,11 +133,3 @@ jobs:
git.demonkernel.io.vn/${{ steps.meta.outputs.repo }}:latest
git.demonkernel.io.vn/${{ steps.meta.outputs.repo }}:${{ steps.meta.outputs.version }}
deploy-via-portainer:
if: gitea.ref == 'refs/heads/main'
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Trigger Portainer Webhook
run: |
curl -X POST "${{ secrets.PORTAINER_WEBHOOK_URL }}"
+5 -5
View File
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: drinkool_frontend
name: drinkool-frontend
labels:
app: web
spec:
@@ -14,11 +14,11 @@ spec:
labels:
app: web
spec:
imagePullSecrets:
- name: gitea-registry-secret
containers:
- name: nginx-container
image: nginx:latest
ports:
- containerPort: 80
- name: frontend-container
image: git.demonkernel.io.vn/foodsurf/frontend:latest
resources:
limits:
cpu: "50m"
+1 -1
View File
@@ -10,7 +10,7 @@ const zipPath = "release.zip";
console.log(`📦 Đang nén file cho version: ${version}...`);
execSync(`zip -r ${zipPath} out`, {
execSync(`cd out && zip -r ../${zipPath} .`, {
stdio: "inherit",
});