Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bd4b0c668d | |||
| 8d0247024d | |||
| 9ad66301de | |||
| 5593c4fccc | |||
| 801b804d2d | |||
| 7534f41c6e | |||
| 2873952f10 | |||
| e448d5ebaf | |||
| 1c9b076316 | |||
| 25c44755b9 |
@@ -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
|
||||
@@ -69,9 +87,14 @@ jobs:
|
||||
git config --global user.name "gitea-actions"
|
||||
git config --global user.email "actions-user@noreply.git.demonkernel.io.vn"
|
||||
|
||||
REPO_NAME="${{ gitea.repository }}"
|
||||
|
||||
git remote set-url origin ssh://git@$TARGET_IP:222/${REPO_NAME}.git
|
||||
|
||||
git rm -r --cached .
|
||||
git add .
|
||||
git commit -m "chore: release [ci skip]"
|
||||
|
||||
git push
|
||||
fi
|
||||
|
||||
@@ -112,11 +135,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 }}"
|
||||
|
||||
+4
-4
@@ -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
@@ -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",
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user