From 7842a38149221621071247756a8e4412426ee9e7 Mon Sep 17 00:00:00 2001 From: piremina Date: Wed, 16 Apr 2025 14:17:37 +0200 Subject: [PATCH 1/6] Update bonjour.c --- TP1/src/bonjour.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/TP1/src/bonjour.c b/TP1/src/bonjour.c index e69de29b..c0961741 100644 --- a/TP1/src/bonjour.c +++ b/TP1/src/bonjour.c @@ -0,0 +1,3 @@ +int main { +printf("Bonjour à tous") +} From 6b26bd4c4e851c6a5c902e6374bf479e0484a842 Mon Sep 17 00:00:00 2001 From: piremina Date: Wed, 16 Apr 2025 14:21:10 +0200 Subject: [PATCH 2/6] Update bonjour.c --- TP1/src/bonjour.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TP1/src/bonjour.c b/TP1/src/bonjour.c index c0961741..c809bd75 100644 --- a/TP1/src/bonjour.c +++ b/TP1/src/bonjour.c @@ -1,3 +1,3 @@ -int main { -printf("Bonjour à tous") +int main () { +printf("Bonjour à tous"); } From e95ba324d3f28a2e060e06189ecd3e61804a7062 Mon Sep 17 00:00:00 2001 From: piremina Date: Wed, 16 Apr 2025 14:21:54 +0200 Subject: [PATCH 3/6] Create main.yml --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1 @@ + From 7baa9ed388dd9efd6ec07094b0b26569d797fc45 Mon Sep 17 00:00:00 2001 From: piremina Date: Wed, 16 Apr 2025 14:22:20 +0200 Subject: [PATCH 4/6] Update bonjour.c From f4f3959b9434dfe10b6fb637258da43aac284de4 Mon Sep 17 00:00:00 2001 From: piremina Date: Wed, 16 Apr 2025 14:23:39 +0200 Subject: [PATCH 5/6] Update main.yml --- .github/workflows/main.yml | 57 +++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8b137891..94cd3104 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1 +1,56 @@ - +name: Industrialisation continue sur le serveur Alwaysdata +on: push +jobs: + Connexion: + runs-on: ubuntu-latest + steps: + - name: Connexion SSH avec le serveur + uses: appleboy/ssh-action@master + with: + host: "ssh-${{ secrets.USERNAME }}.alwaysdata.net" + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + script: | + cd $HOME/www/ + Copy: + needs: Connexion + runs-on: ubuntu-latest + steps: + - name: Connexion SSH avec le serveur + uses: appleboy/ssh-action@master + with: + host: "ssh-${{ secrets.USERNAME }}.alwaysdata.net" + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + script: | + last_directory=$(basename ${{ runner.workspace }}) + cd $HOME/www/ + git clone https://github.com/${{ github.repository }}.git + # Vérifier si le répertoire de destination existe + if [ "$(ls -A ./flask)" ]; then + rsync -r ./$last_directory/ ./flask + rm -rf ./$last_directory + else + echo "Le répertoire flask de destination sur votre serveur n'existe pas" + exit 1 + fi + Restart: + needs: Copy + runs-on: ubuntu-latest + steps: + - name: Restart Alwaysdata site + run: | + response_code=$(curl -s -o /dev/null -w "%{http_code}" -X POST --basic --user "${{ secrets.ALWAYSDATA_TOKEN }}:" https://api.alwaysdata.com/v1/site/${{ secrets.ALWAYSDATA_SITE_ID }}/restart/) + # Vérifier le code de réponse HTTP + if [ "$response_code" -eq 204 ]; then + echo "Relance de votre site réussi" + elif [ "$response_code" -eq 404 ]; then + echo "Vous n'avez pas renseigner correctement votre secret ALWAYSDATA_SITE_ID" + exit 1 # Quitter avec un code d'erreur + elif [ "$response_code" -eq 401 ]; then + echo "Vous n'avez pas renseigner correctement votre secret ALWAYSDATA_TOKEN" + exit 1 # Quitter avec un code d'erreur + else + echo "Échec du redémarrage avec le code de réponse : $response_code" + exit 1 # Quitter avec un code d'erreur + fi From a65a8655b64dc6c48cf9f1e915759bae12933220 Mon Sep 17 00:00:00 2001 From: piremina Date: Wed, 16 Apr 2025 14:24:53 +0200 Subject: [PATCH 6/6] Update main.yml --- .github/workflows/main.yml | 57 +------------------------------------- 1 file changed, 1 insertion(+), 56 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 94cd3104..8b137891 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,56 +1 @@ -name: Industrialisation continue sur le serveur Alwaysdata -on: push -jobs: - Connexion: - runs-on: ubuntu-latest - steps: - - name: Connexion SSH avec le serveur - uses: appleboy/ssh-action@master - with: - host: "ssh-${{ secrets.USERNAME }}.alwaysdata.net" - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - script: | - cd $HOME/www/ - Copy: - needs: Connexion - runs-on: ubuntu-latest - steps: - - name: Connexion SSH avec le serveur - uses: appleboy/ssh-action@master - with: - host: "ssh-${{ secrets.USERNAME }}.alwaysdata.net" - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - script: | - last_directory=$(basename ${{ runner.workspace }}) - cd $HOME/www/ - git clone https://github.com/${{ github.repository }}.git - # Vérifier si le répertoire de destination existe - if [ "$(ls -A ./flask)" ]; then - rsync -r ./$last_directory/ ./flask - rm -rf ./$last_directory - else - echo "Le répertoire flask de destination sur votre serveur n'existe pas" - exit 1 - fi - Restart: - needs: Copy - runs-on: ubuntu-latest - steps: - - name: Restart Alwaysdata site - run: | - response_code=$(curl -s -o /dev/null -w "%{http_code}" -X POST --basic --user "${{ secrets.ALWAYSDATA_TOKEN }}:" https://api.alwaysdata.com/v1/site/${{ secrets.ALWAYSDATA_SITE_ID }}/restart/) - # Vérifier le code de réponse HTTP - if [ "$response_code" -eq 204 ]; then - echo "Relance de votre site réussi" - elif [ "$response_code" -eq 404 ]; then - echo "Vous n'avez pas renseigner correctement votre secret ALWAYSDATA_SITE_ID" - exit 1 # Quitter avec un code d'erreur - elif [ "$response_code" -eq 401 ]; then - echo "Vous n'avez pas renseigner correctement votre secret ALWAYSDATA_TOKEN" - exit 1 # Quitter avec un code d'erreur - else - echo "Échec du redémarrage avec le code de réponse : $response_code" - exit 1 # Quitter avec un code d'erreur - fi +