This repository was archived by the owner on Oct 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Deploy on tag
2+
3+ on :
4+ push :
5+ tags :
6+ " v*"
7+
8+ jobs :
9+ deploy :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - uses : actions/checkout@v2
13+ with :
14+ fetch-depth : 0
15+
16+ - name : Get major of current tag and previous tag
17+ id : vars
18+ run : |
19+ git fetch -a
20+ echo ::set-output name=current_major::$(git tag --sort "-committerdate" | cut -d$'\n' -f1 | cut -d. -f1)
21+ echo ::set-output name=previous_major::$(git tag --sort "-committerdate" | cut -d$'\n' -f2 | cut -d. -f1)
22+
23+ - name : SSH Commands
24+ if : ${{ steps.vars.outputs.current_major == steps.vars.outputs.previous_major }}
25+ uses : appleboy/ssh-action@v0.1.4
26+ env :
27+ PROCESS_PATH : ${{ secrets.CD_PROCESS_PATH }}
28+ PROCESS_ID : ${{ secrets.CD_PROCESS_ID }}
29+ GITHUB_REF : ${{ env.GITHUB_REF }}
30+ with :
31+ host : ${{ secrets.CD_HOST }}
32+ username : ${{ secrets.CD_USERNAME }}
33+ key : ${{ secrets.CD_SECRET_KEY }}
34+ script_stop : true
35+ envs : PROCESS_PATH, PROCESS_ID, GITHUB_REF
36+ script : |
37+ source ~/.profile
38+ source ~/.nvm/nvm.sh
39+ cd $PROCESS_PATH
40+ pip install --user -U pipenv
41+ git pull origin main --tags
42+ git checkout $GITHUB_REF
43+ pipenv install
44+ pm2 restart $PROCESS_ID -s
You can’t perform that action at this time.
0 commit comments