File tree Expand file tree Collapse file tree 3 files changed +78
-0
lines changed Expand file tree Collapse file tree 3 files changed +78
-0
lines changed Original file line number Diff line number Diff line change 1+ keys
Original file line number Diff line number Diff line change 1+ # GitHub Action to deploy Node.js, Python, PHP and more to Stackhero
2+
3+ See [ https://www.stackhero.io/en/stackhero/documentations ] ( https://www.stackhero.io/en/stackhero/documentations )
4+
5+
6+ ## Deploy a new version
7+
8+ ``` bash
9+ reason=" New version"
10+ git add -A .
11+ git commit -m " ${reason} "
12+ git tag -a v1 -m " ${reason} "
13+ git push --follow-tags
14+ ```
Original file line number Diff line number Diff line change 1+ name : Deploy to Stackhero
2+ # run-name: Deploy branch ${{ github.ref_name }} to Stackhero
3+ description : Deploy your code to a Stackhero instance
4+
5+
6+ inputs :
7+ ssh_private_key :
8+ description : ' Your SSH private key'
9+ required : true
10+
11+ endpoint :
12+ description : ' Endpoint of your instance (xxxxxx.stackhero-network.com or your customized domain)'
13+ required : true
14+
15+ runs :
16+ using : " composite"
17+ steps :
18+ - uses : actions/checkout@v4
19+
20+ - name : Check inputs
21+ shell : bash
22+ run : |
23+ error=0
24+
25+ if [ "${{ inputs.ssh_private_key }}" = "" ]
26+ then
27+ echo "::error::The \"ssh_private_key\" argument should be passed to this action."
28+ error=1
29+ fi
30+
31+ if [ "${{ inputs.endpoint }}" = "" ]
32+ then
33+ echo "::error::The \"endpoint\" argument should be passed to this action."
34+ error=1
35+ fi
36+
37+ if [ "$error" == 1 ]
38+ then
39+ exit 1
40+ fi
41+
42+ - name : Configure SSH
43+ shell : bash
44+ run : |
45+ install -m 600 -D /dev/null ~/.ssh/private_key
46+ echo "${{ inputs.ssh_private_key }}" > ~/.ssh/private_key
47+ git config --local --add core.sshCommand 'ssh -i ~/.ssh/private_key'
48+
49+ ssh-keyscan -p 222 ${{ inputs.endpoint }} > ~/.ssh/known_hosts
50+
51+ - name : Configure GIT
52+ shell : bash
53+ run : |
54+ git config --global user.email "actions@github.com"
55+ git config --global user.name "GitHub actions"
56+
57+ - name : Deploy
58+ shell : bash
59+ run : |
60+ git fetch --unshallow origin
61+ git remote add stackhero ssh://stackhero@${{ inputs.endpoint }}:222/project.git
62+
63+ git push -f stackhero ${{ github.ref_name }}:main
You can’t perform that action at this time.
0 commit comments