@@ -22,30 +22,10 @@ jobs:
2222 cancel-in-progress : true
2323
2424 name : Deploy
25- outputs :
26- run_build : ${{ steps.check_build.outputs.run_build }}
2725
2826 # Steps represent a sequence of tasks that will be executed as part of the job
2927 steps :
30- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
31- - name : Checkout
32- uses : actions/checkout@v4
33- with :
34- fetch-depth : 2
35- - name : Determine Build Requirement
36- id : check_build
37- run : |
38- echo "========== Modified Files =========="
39- git diff --name-only HEAD^ HEAD
40- echo "===================================="
41- if grep -q "src" <<< $(git diff --name-only HEAD^ HEAD); then
42- echo "Build Required"
43- echo "::set-output name=run_build::true"
44- else
45- echo "::set-output name=run_build::false"
46- fi
47-
48- - name : Deploying
28+ - name : Deploy to server
4929 uses : appleboy/ssh-action@master
5030 with :
5131 host : ${{ secrets.REMOTE_HOST }}
5939 git fetch
6040 echo "Pulling Changes from Github"
6141 git pull
62- echo "Installing Modules"
63- yarn install
64- echo "Restarting Application"
65- pm2 restart hacksu-2021
66- echo "Finished"
67- exit
68-
69- build :
70- name : Build
71- needs : deploy
72- if : github.event_name == 'workflow_dispatch' || needs.deploy.outputs.run_build == 'true'
73- runs-on : ubuntu-latest
74- steps :
75- - name : Building Vue
76- uses : appleboy/ssh-action@master
77- with :
78- host : ${{ secrets.REMOTE_HOST }}
79- username : ${{ secrets.REMOTE_USER }}
80- key : ${{ secrets.KEY }}
81- port : ${{ secrets.PORT }}
82- # passphrase: ${{ secrets.KEY_PASSPHRASE }}
83- script : |
84- cd /var/www/hacksu-2021
85- yarn build # goes to dist2 by default
86- ls dist2
87- rm -rf dist
88- mv dist2 dist
89- exit
42+ echo "Take down docker compose stack"
43+ docker compose down
44+ echo "Start docker compose stack and rebuild"
45+ docker compose up --build -d
0 commit comments