123
This commit is contained in:
		
							parent
							
								
									774123eefc
								
							
						
					
					
						commit
						873c000060
					
				
							
								
								
									
										27
									
								
								.gitea/workflows/ssh_test.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								.gitea/workflows/ssh_test.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,27 @@
 | 
			
		||||
name: SSH 连接测试
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  workflow_dispatch:  # 手动触发
 | 
			
		||||
  push:
 | 
			
		||||
    branches:
 | 
			
		||||
      - main  # 仅main分支触发
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  ssh-test:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: 检查SSH密钥
 | 
			
		||||
        run: |
 | 
			
		||||
          if [ -z "${{ secrets.KEY }}" ]; then
 | 
			
		||||
            echo "SSH私钥未配置"
 | 
			
		||||
            exit 1
 | 
			
		||||
          fi
 | 
			
		||||
          echo "SSH私钥已配置"
 | 
			
		||||
 | 
			
		||||
      - name: 测试SSH连接
 | 
			
		||||
        run: |
 | 
			
		||||
          echo "${{ secrets.KEY }}" > ssh_key
 | 
			
		||||
          chmod 600 ssh_key
 | 
			
		||||
          ssh -o StrictHostKeyChecking=no \
 | 
			
		||||
              -i ssh_key \
 | 
			
		||||
              ${{ secrets.USER }}@${{ secrets.HOST }} "echo 'SSH连接成功!'"
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user