From 7c7767773a7a8fe9bd03ae241ed3b7fb1c9f6cc1 Mon Sep 17 00:00:00 2001 From: Florian Dejonckheere Date: Mon, 4 Dec 2023 18:47:41 +0100 Subject: [PATCH] Deploy continuously --- .github/workflows/ci-cd.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 6eff008..c3de8a7 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -7,6 +7,7 @@ on: push: branches: - master + workflow_dispatch: jobs: ci: @@ -65,3 +66,21 @@ jobs: file: Dockerfile push: true tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest + + - name: Set up docker context + uses: amirmarmul/docker-context-ssh-action@v2 + with: + ssh-host: ${{ secrets.SSH_HOST }} + ssh-username: ${{ secrets.SSH_USER }} + ssh-private-key: ${{ secrets.SSH_KEY }} + context-name: cloud + context-use: true + + - name: Deploy application + env: + GHCR_USER: ${{ secrets.GHCR_TOKEN }} + GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }} + COMPOSE_PROJECT_NAME: ${{ github.event.repository.name }} + run: | + docker-compose pull + docker-compose up --detach app