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
This commit was merged in pull request #7.
This commit is contained in:
2026-03-29 14:15:26 +00:00
2 changed files with 22 additions and 1 deletions
+21
View File
@@ -17,6 +17,24 @@ jobs:
outputs: outputs:
new_version: ${{ steps.set_output.outputs.version }} new_version: ${{ steps.set_output.outputs.version }}
steps: 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 - uses: actions/checkout@v6
with: with:
fetch-depth: 0 fetch-depth: 0
@@ -69,9 +87,12 @@ jobs:
git config --global user.name "gitea-actions" git config --global user.name "gitea-actions"
git config --global user.email "actions-user@noreply.git.demonkernel.io.vn" 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 rm -r --cached .
git add . git add .
git commit -m "chore: release [ci skip]" git commit -m "chore: release [ci skip]"
git push git push
fi fi
+1 -1
View File
@@ -10,7 +10,7 @@ const zipPath = "release.zip";
console.log(`📦 Đang nén file cho version: ${version}...`); console.log(`📦 Đang nén file cho version: ${version}...`);
execSync(`zip -r ${zipPath} out`, { execSync(`cd out && zip -r ../${zipPath} .`, {
stdio: "inherit", stdio: "inherit",
}); });