Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com> Reviewed-on: #18
This commit was merged in pull request #18.
This commit is contained in:
@@ -13,16 +13,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: gerlero/apt-install@v1
|
- uses: gerlero/apt-install@v1
|
||||||
with:
|
with:
|
||||||
packages: openssh-client
|
packages: docker.io
|
||||||
|
|
||||||
- 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
|
- name: Setup SSH Key
|
||||||
run: |
|
run: |
|
||||||
@@ -31,7 +22,7 @@ jobs:
|
|||||||
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519
|
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519
|
||||||
chmod 600 ~/.ssh/id_ed25519
|
chmod 600 ~/.ssh/id_ed25519
|
||||||
|
|
||||||
ssh-keyscan -p 222 -t ed25519 $TARGET_IP >> ~/.ssh/known_hosts
|
ssh-keyscan -t ed25519 vps.demonkernel.io.vn >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
@@ -74,7 +65,7 @@ jobs:
|
|||||||
|
|
||||||
REPO_NAME="${{ gitea.repository }}"
|
REPO_NAME="${{ gitea.repository }}"
|
||||||
|
|
||||||
git remote set-url origin ssh://git@$TARGET_IP:222/${REPO_NAME}.git
|
git remote set-url origin ssh://git@vps.demonkernel.io.vn/${REPO_NAME}.git
|
||||||
|
|
||||||
git rm -r --cached .
|
git rm -r --cached .
|
||||||
git add .
|
git add .
|
||||||
|
|||||||
Reference in New Issue
Block a user