Add SSH key setup for git clone operations
Build and deploy Hugo site / build (push) Failing after 9s
Build and deploy Hugo site / deploy (push) Has been skipped

This commit is contained in:
YaoLei
2026-07-06 18:19:37 +08:00
parent a9297e5f24
commit db134548e1
+13 -5
View File
@@ -5,22 +5,30 @@ jobs:
build:
runs-on: act_runner1
container:
image: 192.168.254.5:5000/hugo:v0.163.3
image: learngaming.top:5000/hugo:v0.163.3
steps:
- name: Create Hugo site
run: |
set -e
hugo new site /tmp/hugo-site
- name: Setup SSH key for git clone
run: |
set -e
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H gitea.learngaming.top >> ~/.ssh/known_hosts
- name: Clone FixIt theme
run: |
set -e
git clone --depth=1 http://192.168.254.5:3000/blogs/FixIt.git /tmp/hugo-site/themes/FixIt
git clone --depth=1 ssh://git@gitea.learngaming.top:2222/blogs/FixIt.git /tmp/hugo-site/themes/FixIt
- name: Clone repository to content directory
run: |
set -e
REPO_URL="http://192.168.254.5:3000/blogs/outcomes.git"
REPO_URL="ssh://git@gitea.learngaming.top:2222/blogs/outcomes.git"
if [ -n "${CI_REPOSITORY_URL:-}" ]; then
REPO_URL="${CI_REPOSITORY_URL}"
fi
@@ -59,6 +67,6 @@ jobs:
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H 192.168.254.5 >> ~/.ssh/known_hosts
ssh-keyscan -H www.learngaming.top >> ~/.ssh/known_hosts
# Deploy using rsync
rsync -avz --delete ./public/ root@192.168.254.5:/opt/1panel/www/sites/www.learngaming.top/index/
rsync -avz --delete ./public/ root@www.learngaming.top:/opt/1panel/www/sites/www.learngaming.top/index/