Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Auto deployment: Simple action #155

Merged
merged 3 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/deploy-staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Deploy application to staging environment

on:
push:
branches: [main]
workflow_dispatch:

jobs:
deploy:
runs-on: [self-hosted]
steps:
- name: Execute the build and run script on the server
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: "/services/duogradus/build-and-run.sh"
13 changes: 13 additions & 0 deletions build-and-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Stop the current docker compose server
docker compose down

# Download the current code main branch from github
git fetch --all
# Yes, this is the desired option!
git reset --hard origin/master

# Rebuild the images with the new code
docker compose build

# Restart the service
docker compose up -d
Loading