Skip to content

Commit 6333d3b

Browse files
committed
feat: deployment pipeline
1 parent b0db065 commit 6333d3b

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/deploy.yaml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Continuous Deployment Pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
paths-ignore:
8+
- "**.md"
9+
- "LICENSE"
10+
11+
jobs:
12+
push:
13+
name: Push Stage
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Sync local repo with remote repo
18+
uses: appleboy/ssh-action@master
19+
env:
20+
PROJECT_DIR: ${{ secrets.PROJECT_DIR }}
21+
with:
22+
host: ${{ secrets.SSH_HOSTNAME }}
23+
username: ${{ secrets.SSH_USERNAME }}
24+
key: ${{ secrets.SSH_PRIVATE_KEY }}
25+
passphrase: ${{ secrets.SSH_PRIVATE_KEY_PASSPHRASE }}
26+
envs: PROJECT_DIR
27+
script_stop: true
28+
script: |
29+
cd "${PROJECT_DIR}/"
30+
sudo git fetch origin
31+
sudo git reset --hard origin/main
32+
33+
build:
34+
name: Build Stage
35+
needs: push
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- name: Build the latest container(s)
40+
uses: appleboy/ssh-action@master
41+
env:
42+
PROJECT_DIR: ${{ secrets.PROJECT_DIR }}
43+
with:
44+
host: ${{ secrets.SSH_HOSTNAME }}
45+
username: ${{ secrets.SSH_USERNAME }}
46+
key: ${{ secrets.SSH_PRIVATE_KEY }}
47+
passphrase: ${{ secrets.SSH_PRIVATE_KEY_PASSPHRASE }}
48+
envs: PROJECT_DIR
49+
script_stop: true
50+
script: |
51+
cd "${PROJECT_DIR}/"
52+
sudo docker compose --env-file .env build

0 commit comments

Comments
 (0)