-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
65 lines (52 loc) · 1.62 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Deploy to Stackhero
description: Deploy your code to a Stackhero instance
branding:
icon: upload-cloud
color: blue
inputs:
ssh_private_key:
description: 'Your SSH private key'
required: true
endpoint:
description: 'Endpoint of your instance (xxxxxx.stackhero-network.com or your customized domain)'
required: true
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- name: Check inputs
shell: bash
run: |
error=0
if [ "${{ inputs.ssh_private_key }}" = "" ]
then
echo "::error::The \"ssh_private_key\" argument should be passed to this action."
error=1
fi
if [ "${{ inputs.endpoint }}" = "" ]
then
echo "::error::The \"endpoint\" argument should be passed to this action."
error=1
fi
if [ "$error" == 1 ]
then
exit 1
fi
- name: Configure SSH
shell: bash
run: |
install -m 600 -D /dev/null ~/.ssh/private_key
echo "${{ inputs.ssh_private_key }}" > ~/.ssh/private_key
git config --local --add core.sshCommand 'ssh -i ~/.ssh/private_key'
ssh-keyscan -p 222 ${{ inputs.endpoint }} > ~/.ssh/known_hosts
- name: Configure GIT
shell: bash
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub actions"
- name: Deploy
shell: bash
run: |
git fetch --unshallow origin
git remote add stackhero ssh://stackhero@${{ inputs.endpoint }}:222/project.git
git push -f stackhero ${{ github.ref_name }}:main