Update .gitea/workflows/deploy.yml
This commit is contained in:
@@ -1,13 +1,26 @@
|
|||||||
stages:
|
# Exemple de configuration d'un pipeline avec Gitea Actions
|
||||||
- build
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main # Déclenche l'action pour les commits sur la branche principale
|
||||||
|
|
||||||
build:
|
jobs:
|
||||||
image: alpine:latest
|
ssh-connect:
|
||||||
stage: build
|
runs-on: ubuntu-latest
|
||||||
script:
|
steps:
|
||||||
- apk add --no-cache openssh
|
- name: Setup SSH
|
||||||
- mkdir -p ~/.ssh
|
run: |
|
||||||
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
# Créez un dossier .ssh
|
||||||
- chmod 600 ~/.ssh/id_rsa
|
mkdir -p ~/.ssh
|
||||||
- ssh-keyscan 192.168.1.87 >> ~/.ssh/known_hosts
|
|
||||||
- ssh -i ~/.ssh/id_rsa kerboul@192.168.1.87 'echo "Connexion réussie"'
|
# 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