Skip to content

Commit 3c66972

Browse files
authored
Add GitHub Actions workflow for server deployment
This workflow automates the deployment process to the server, handling both cloning and updating the repository as well as managing Docker containers.
1 parent 3caea6f commit 3c66972

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Deploy to server
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
deploy:
8+
name: Deploy
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Deploy to server
13+
uses: appleboy/ssh-action@v1.2.3
14+
with:
15+
host: ${{ secrets.CL_1 }}
16+
username: ${{ secrets.SERVER_USER }}
17+
password: ${{ secrets.PASSWORD }} # im so lazy for setting ssh keys to 2$ server...
18+
script: |
19+
mkdir -p ~/prod/tiktokbot
20+
cd ~/prod/tiktokbot
21+
22+
# First clone OR update repo
23+
if [ -d .git ]; then
24+
git fetch --all
25+
git reset --hard origin/master
26+
else
27+
git clone https://github.com/destroydevs/TikFetchBot.git .
28+
fi
29+
30+
export TELOXIDE_TOKEN=${{ secrets.TELOXIDE_TOKEN }}
31+
32+
docker compose up -d --build
33+
34+
docker image prune -f

0 commit comments

Comments
 (0)