11name : Deploy to remote server
22description : Deploy to remote server
33
4+ inputs :
5+ deploy_ssh_private_key :
6+ description : SSH private key
7+ required : true
8+ deploy_ssh_host :
9+ description : SSH host
10+ required : true
11+ deploy_ssh_port :
12+ description : SSH port
13+ required : true
14+ deploy_ssh_user :
15+ description : SSH user
16+ required : true
17+ deploy_instance :
18+ description : Deploy instance
19+ required : true
20+ deploy_type :
21+ description : Deploy type
22+ required : false
23+ default : " "
24+ deploy_build_cmd :
25+ description : Build command
26+ required : false
27+ default : " "
28+ deploy_exec_start :
29+ description : Start command
30+ required : false
31+ default : " "
32+ deploy_db :
33+ description : Database name
34+ required : false
35+ default : " "
36+
437runs :
538 using : " composite"
639
@@ -11,58 +44,58 @@ runs:
1144 - name : Set up SSH agent
1245 uses : webfactory/ssh-agent@v0.9.0
1346 with :
14- ssh-private-key : ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
47+ ssh-private-key : ${{ inputs.deploy_ssh_private_key }}
1548
1649 - name : Add remote host to known_hosts
50+ shell : bash
1751 run : |
18- ssh-keyscan -p ${{ secrets.DEPLOY_SSH_PORT }} ${{ secrets.DEPLOY_SSH_HOST }} >> ~/.ssh/known_hosts
52+ ssh-keyscan -p ${{ inputs.deploy_ssh_port }} ${{ inputs.deploy_ssh_host }} >> ~/.ssh/known_hosts
1953
2054 - name : Generate deploy.yml
55+ shell : bash
2156 run : |
2257 cat > deploy.yml <<EOF
23- ${{ secrets.DEPLOY_INSTANCE }}:
24- ssh_host: ${{ secrets.DEPLOY_SSH_USER }}@${{ secrets.DEPLOY_SSH_HOST }}
25- ssh_port: ${{ secrets.DEPLOY_SSH_PORT }}
58+ ${{ inputs.deploy_instance }}:
59+ ssh_host: ${{ inputs.deploy_ssh_user }}@${{ inputs.deploy_ssh_host }}
60+ ssh_port: ${{ inputs.deploy_ssh_port }}
2661 repo_url: git@github.com:${{ github.repository }}.git
2762 EOF
2863
2964 - name : Have type of deploy if specified
30- env :
31- deploy_type : ${{ vars.DEPLOY_TYPE }}
32- if : ${{ env.deploy_type != '' }}
65+ if : ${{ inputs.deploy_type != '' }}
66+ shell : bash
3367 run : |
34- echo " type: ${{ env .deploy_type }}" >> deploy.yml
68+ echo " type: ${{ inputs .deploy_type }}" >> deploy.yml
3569
3670 - name : Append build_cmd to deploy.yml if exist
37- env :
38- deploy_build_cmd : ${{ vars.DEPLOY_BUILD_CMD }}
39- if : ${{ env.deploy_build_cmd != '' }}
71+ if : ${{ inputs.deploy_build_cmd != '' }}
72+ shell : bash
4073 run : |
41- echo " build_cmd: ${{ env .deploy_build_cmd }}" >> deploy.yml
74+ echo " build_cmd: ${{ inputs .deploy_build_cmd }}" >> deploy.yml
4275
4376 - name : Append exec_start to deploy.yml if exist
44- env :
45- deploy_exec_start : ${{ vars.DEPLOY_EXEC_START }}
46- if : ${{ env.deploy_exec_start != '' }}
77+ if : ${{ inputs.deploy_exec_start != '' }}
78+ shell : bash
4779 run : |
48- echo " exec_start: ${{ env .deploy_exec_start }}" >> deploy.yml
80+ echo " exec_start: ${{ inputs .deploy_exec_start }}" >> deploy.yml
4981
5082 - name : Append db to deploy.yml if exist
51- env :
52- deploy_db : ${{ secrets.DEPLOY_DB }}
53- if : ${{ env.deploy_db != '' }}
83+ if : ${{ inputs.deploy_db != '' }}
84+ shell : bash
5485 run : |
55- echo " db: ${{ env .deploy_db }}" >> deploy.yml
86+ echo " db: ${{ inputs .deploy_db }}" >> deploy.yml
5687
5788 - name : Install uv
5889 uses : astral-sh/setup-uv@v5
5990
6091 - name : Install deploy
92+ shell : bash
6193 run : uv tool install "git+https://github.com/trobz/deploy.py.git"
6294
6395 - name : Deploy
96+ shell : bash
6497 run : |
65- deploy --config deploy.yml --verbose update ${{ secrets.DEPLOY_INSTANCE }}
98+ deploy --config deploy.yml --verbose update ${{ inputs.deploy_instance }}
6699
67100branding :
68101 icon : " box"
0 commit comments