fix: 修改为SSH密码认证方式部署
This commit is contained in:
@@ -77,24 +77,15 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Install SSH client
|
- name: Install SSH client
|
||||||
run: |
|
run: |
|
||||||
if ! command -v ssh &> /dev/null; then
|
|
||||||
if command -v apk &> /dev/null; then
|
if command -v apk &> /dev/null; then
|
||||||
apk add --no-cache openssh-client
|
apk add --no-cache openssh-client sshpass
|
||||||
elif command -v apt-get &> /dev/null; then
|
elif command -v apt-get &> /dev/null; then
|
||||||
apt-get update && apt-get install -y openssh-client
|
apt-get update && apt-get install -y openssh-client sshpass
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Setup SSH key
|
|
||||||
run: |
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_rsa
|
|
||||||
chmod 600 ~/.ssh/id_rsa
|
|
||||||
ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts 2>/dev/null || true
|
|
||||||
|
|
||||||
- name: Deploy to server
|
- name: Deploy to server
|
||||||
run: |
|
run: |
|
||||||
ssh -o StrictHostKeyChecking=no ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} << 'EOF'
|
sshpass -p '${{ secrets.DEPLOY_PASSWORD }}' ssh -o StrictHostKeyChecking=no ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} << 'EOF'
|
||||||
cd ${{ secrets.DEPLOY_PATH }}
|
cd ${{ secrets.DEPLOY_PATH }}
|
||||||
docker compose pull
|
docker compose pull
|
||||||
docker compose down
|
docker compose down
|
||||||
|
|||||||
Reference in New Issue
Block a user