From fbbc6978d5bf56fc7fe56188b5e94fb0fecbb965 Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Mon, 26 Feb 2024 15:24:47 +0100 Subject: [PATCH] Deploy backend on push --- .gitea/workflows/deploy.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index d918ae1..e2d21c8 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -28,3 +28,28 @@ jobs: chmod 0600 key scp -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key -r dist/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}: - run: echo "The website has been deployed. visit https://clyde.herisson.ovh/" + + deploy-backend: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'temurin' + - uses: gradle/gradle-build-action@v3 + - name: building + run: ./gradlew backend:build + - name: pushing to the server + working-directory: ./backend + run: | + echo "${{ secrets.SSH_KEY }}" > key + chmod 0600 key + scp -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key -r backend/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:api/ + - name: restarting the backend + working-directory: ./backend + run: | + echo "${{ secrets.SSH_KEY }}" > key + chmod 0600 key + ssh -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key "docker-compose restart" + - run: echo "The backend has been deployed. running at https://clyde.herisson.ovh/api"