mgloc / GameShell

a game to learn (or teach) how to use standard commands in a Unix shell
GNU General Public License v3.0
2 stars 0 forks source link

Automatiser le déploiement de l'API et DB #11

Open mgloc opened 8 months ago

mgloc commented 7 months ago

Lien exemple github workflow connection par ssh

name: Deploy

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the "main" branch
  push:
    branches: [ "main" ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Copy repository contents via scp
        uses: appleboy/scp-action@master
        env:
          HOST: ${{ secrets.HOST }}
          USERNAME: ${{ secrets.USERNAME }}
          PORT: ${{ secrets.PORT }}
          KEY: ${{ secrets.SSHKEY }}
        with:
          source: "."
          target: "/home/${{ secrets.USERNAME }}/hackathon"

      - name: Executing remote command
        uses: appleboy/ssh-action@master
        with:
          host: ${{ secrets.HOST }}
          USERNAME: ${{ secrets.USERNAME }}
          PORT: ${{ secrets.PORT }}
          KEY: ${{ secrets.SSHKEY }}
          script: cd /home/${{ secrets.USERNAME }}/hackathon && docker compose down && docker compose build && docker compose up -d && sleep 5s && docker ps