File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Deploy sample platform
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ push :
6
+ branches : [ master ]
7
+
8
+ env :
9
+ DEPLOY_BRANCH : master
10
+
11
+ jobs :
12
+ deploy :
13
+ runs-on : ubuntu-latest
14
+ permissions :
15
+ id-token : write
16
+ contents : read # required for actions/checkout
17
+ steps :
18
+ - name : Deployment with ssh commands using ssh key
19
+ uses : appleboy/ssh-action@master
20
+ with :
21
+ host : ${{ vars.PLATFORM_DOMAIN }}
22
+ username : ${{ vars.SSH_USER }}
23
+ key : ${{ secrets.SSH_KEY_PRIVATE }}
24
+ port : 22
25
+ script_stop : true
26
+ command_timeout : 10m
27
+ script : |
28
+ echo "jump to app folder"
29
+ cd /var/www/sample-platform
30
+
31
+ echo "checkout branch"
32
+ sudo git restore .
33
+ sudo git checkout ${{env.DEPLOY_BRANCH}}
34
+ sudo git fetch origin ${{env.DEPLOY_BRANCH}}
35
+
36
+ echo "avoid merge conflicts"
37
+ sudo git reset --hard origin/${{env.DEPLOY_BRANCH}}
38
+ sudo git clean -f -d
39
+
40
+ echo "update app from git"
41
+ sudo git pull origin ${{env.DEPLOY_BRANCH}}
42
+
43
+ echo "update dependencies"
44
+ sudo python -m pip install -r requirements.txt
45
+
46
+ echo "run migrations"
47
+ sudo FLASK_APP=./run.py flask db upgrade
48
+
49
+ echo "reload server"
50
+ sudo systemctl reload platform
You can’t perform that action at this time.
0 commit comments