Skip to content

Commit 55a072a

Browse files
committed
Add GitHub Actions workflows for Auto-Merge with API Health Checks and CI/CD Remote Deployment
1 parent 550b513 commit 55a072a

2 files changed

Lines changed: 76 additions & 0 deletions

File tree

.github/workflows/auto-merge.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Sanity Checks & Auto Merge to Main
2+
3+
on:
4+
push:
5+
branches:
6+
- Develop
7+
8+
jobs:
9+
verify-and-merge:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Verify BookStack API Health
18+
env:
19+
BOOKSTACK_URL: ${{ secrets.BOOKSTACK_BASE_URL }}
20+
BOOKSTACK_TOKEN: ${{ secrets.BOOKSTACK_TOKEN_ID }}:${{ secrets.BOOKSTACK_TOKEN_SECRET }}
21+
run: |
22+
echo "Pinging BookStack Server..."
23+
curl -s -f -H "Authorization: Token $BOOKSTACK_TOKEN" "$BOOKSTACK_URL/api/docs" > /dev/null
24+
echo "BookStack API is Online!"
25+
26+
- name: Verify OpenAI API Health
27+
env:
28+
OPENAI_KEY: ${{ secrets.OPENAI_API_KEY }}
29+
run: |
30+
echo "Pinging OpenAI Systems..."
31+
curl -s -f -H "Authorization: Bearer $OPENAI_KEY" "https://api.openai.com/v1/models" > /dev/null
32+
echo "OpenAI API is Online!"
33+
34+
- name: Merge Develop into Main
35+
run: |
36+
git config --global user.name "GitHub Auto-Merge Action"
37+
git config --global user.email "actions@github.com"
38+
39+
# Checkout Main and align it with the remote
40+
git checkout Main
41+
git pull origin Main || echo "Main not present on remote"
42+
43+
# Merge Develop securely into Main
44+
git merge origin/Develop --allow-unrelated-histories
45+
46+
# Push the changes
47+
git push origin Main

.github/workflows/deploy.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Auto Deploy Chatbot to Production
2+
3+
on:
4+
push:
5+
branches:
6+
- Main
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Execute Remote SSH Commands
13+
uses: appleboy/ssh-action@v1.0.3
14+
with:
15+
host: ${{ secrets.SERVER_HOST }}
16+
username: ${{ secrets.SERVER_USER }}
17+
key: ${{ secrets.SSH_PRIVATE_KEY }}
18+
script: |
19+
echo "Moving to Application Directory..."
20+
cd /opt/bookstack-mcp/chatbot
21+
22+
echo "Pulling latest changes from Git..."
23+
git pull origin Main
24+
25+
echo "Rebuilding and restarting Docker containers..."
26+
docker compose down
27+
docker compose up --build chatbot -d
28+
29+
echo "Deployment Complete!"

0 commit comments

Comments
 (0)