Update .gitea/workflows/deploy.yml
This commit is contained in:
@@ -1,13 +1,26 @@
|
||||
stages:
|
||||
- build
|
||||
# Exemple de configuration d'un pipeline avec Gitea Actions
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main # Déclenche l'action pour les commits sur la branche principale
|
||||
|
||||
build:
|
||||
image: alpine:latest
|
||||
stage: build
|
||||
script:
|
||||
- apk add --no-cache openssh
|
||||
- mkdir -p ~/.ssh
|
||||
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
||||
- chmod 600 ~/.ssh/id_rsa
|
||||
- ssh-keyscan 192.168.1.87 >> ~/.ssh/known_hosts
|
||||
- ssh -i ~/.ssh/id_rsa kerboul@192.168.1.87 'echo "Connexion réussie"'
|
||||
jobs:
|
||||
ssh-connect:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup SSH
|
||||
run: |
|
||||
# Créez un dossier .ssh
|
||||
mkdir -p ~/.ssh
|
||||
|
||||
# Stocke la clé privée à partir du secret
|
||||
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
|
||||
# Ajoutez l'hôte distant à known_hosts pour éviter les alertes de sécurité
|
||||
ssh-keyscan -H 192.168.1.87 >> ~/.ssh/known_hosts
|
||||
|
||||
- name: Test SSH connection
|
||||
run: |
|
||||
# Testez la connexion SSH vers le serveur distant
|
||||
ssh -o StrictHostKeyChecking=no kerboul@192.168.1.87 "echo 'Connection successful!'"
|
||||
|
||||
Reference in New Issue
Block a user