File tree Expand file tree Collapse file tree 2 files changed +64
-0
lines changed
Expand file tree Collapse file tree 2 files changed +64
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Deploy
2+
3+ on :
4+ push :
5+ branches : [main]
6+
7+ env :
8+ REGISTRY : ghcr.io
9+ REPO : barckcode/tf-mobility
10+
11+ jobs :
12+ build-and-deploy :
13+ runs-on : ubuntu-latest
14+ permissions :
15+ contents : read
16+ packages : write
17+
18+ steps :
19+ - name : Checkout
20+ uses : actions/checkout@v4
21+
22+ - name : Log in to GHCR
23+ uses : docker/login-action@v3
24+ with :
25+ registry : ${{ env.REGISTRY }}
26+ username : ${{ github.actor }}
27+ password : ${{ secrets.GITHUB_TOKEN }}
28+
29+ - name : Build and push frontend
30+ uses : docker/build-push-action@v6
31+ with :
32+ context : ./frontend
33+ push : true
34+ tags : ${{ env.REGISTRY }}/${{ env.REPO }}/frontend:latest,${{ env.REGISTRY }}/${{ env.REPO }}/frontend:${{ github.sha }}
35+
36+ - name : Build and push backend
37+ uses : docker/build-push-action@v6
38+ with :
39+ context : ./backend
40+ push : true
41+ tags : ${{ env.REGISTRY }}/${{ env.REPO }}/backend:latest,${{ env.REGISTRY }}/${{ env.REPO }}/backend:${{ github.sha }}
42+
43+ - name : Build and push etl
44+ uses : docker/build-push-action@v6
45+ with :
46+ context : ./etl
47+ push : true
48+ tags : ${{ env.REGISTRY }}/${{ env.REPO }}/etl:latest,${{ env.REGISTRY }}/${{ env.REPO }}/etl:${{ github.sha }}
49+
50+ - name : Deploy to server
51+ uses : appleboy/ssh-action@v1
52+ with :
53+ host : ${{ secrets.DEPLOY_HOST }}
54+ username : ${{ secrets.DEPLOY_USER }}
55+ key : ${{ secrets.DEPLOY_SSH_KEY }}
56+ script : |
57+ cd /home/observer/tf-mobility
58+ git pull origin main
59+ docker compose build
60+ docker compose up -d frontend backend
61+ docker image prune -f
Original file line number Diff line number Diff line change 1+ * .pem
2+ * .key
3+ * .crt
You can’t perform that action at this time.
0 commit comments