-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
55 lines (55 loc) · 1.92 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
name: Hosty
description: Automate your deployments with ease
inputs:
server_ip:
description: The IP address of the server
required: true
server_user:
description: The username to use to connect to the server
required: true
ssh_private_key:
description: The private ssh key to use to connect to the server
required: true
server_sudo_pass:
description: The sudo password of the user on the server
required: true
handler:
description: The Javascript file to run
required: true
verbose:
description: Show additional debug information
vars:
description: Additional variables to pass to the deployment script
runs:
using: composite
steps:
- name: Set up SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ inputs.ssh_private_key }}
- name: Add VPS to known_hosts
run: ssh-keyscan -H ${{ inputs.server_ip }} >> ~/.ssh/known_hosts
shell: bash
- if: inputs.verbose
run: |
echo 'hosty_server_ip: ${{ inputs.server_ip }}'
echo 'hosty_server_user: ${{ inputs.server_user }}'
echo 'hosty_repo: ${{ github.repository }}'
echo 'hosty_branch: ${{ github.event_name == 'delete' && github.event.ref || github.head_ref || github.ref_name }}'
echo 'hosty_event: ${{ github.event_name }}'
shell: bash
- name: Run deployment
env:
hosty_server_ip: ${{ inputs.server_ip }}
hosty_server_user: ${{ inputs.server_user }}
hosty_repo: ${{ github.repository }}
hosty_branch: ${{ github.event_name == 'delete' && github.event.ref || github.head_ref || github.ref_name }}
hosty_event: ${{ github.event_name }}
hosty_vars: ${{ inputs.vars }}
run: node ${{ inputs.handler }}
shell: bash
- if: inputs.verbose
run: cat hosty-playbook.yaml
shell: bash
- run: ANSIBLE_BECOME_PASS=${{ inputs.server_sudo_pass }} ansible-playbook hosty-playbook.yaml ${{ inputs.verbose && '-v' }}
shell: bash