Skip to content

Commit

Permalink
Move deploy job into docker CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Bensge committed Dec 1, 2024
1 parent 27875cd commit 95f1b0a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
32 changes: 31 additions & 1 deletion .github/workflows/build-push-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create and publish a Docker image
name: Create, publish and deploy Docker image

on:
push:
Expand Down Expand Up @@ -64,3 +64,33 @@ jobs:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
deploy:
name: Deploy to Server
needs: build-push-deploy-image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: upload infrastructure files
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_SECONDARY_HOST }}
username: ${{ secrets.SSH_SECONDARY_USERNAME }}
password: ${{ secrets.SSH_SECONDARY_PASSWORD }}
port: ${{ secrets.SSH_SECONDARY_PORT }}
source: infrastructure/*
target: .
- name: execute remote ssh commands
uses: appleboy/ssh-action@master
env:
SECRET: ${{ secrets.ENV_FILE }}
COMMIT_SHA: ${{ github.sha }}
with:
host: ${{ secrets.SSH_SECONDARY_HOST }}
username: ${{ secrets.SSH_SECONDARY_USERNAME }}
password: ${{ secrets.SSH_SECONDARY_PASSWORD }}
port: ${{ secrets.SSH_SECONDARY_PORT }}
envs: SECRET,COMMIT_SHA
script: |
cd Spybot2
echo "$SECRET" > .env
docker-compose -f docker-compose-deploy.yml up
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: Deploy to server via docker image

on:
push:
branches: [ "master", "workflow_dispatch" ]
workflow_dispatch:
jobs:
deploy:
name: Deploy to Server
name: Deploy to Server manually
needs: build-push-deploy-image
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit 95f1b0a

Please sign in to comment.