aboutsummaryrefslogtreecommitdiffhomepage
path: root/.github/actions/reusable-deploy/action.yml
blob: bc69a2e43fd752ba2252722906ff4289d6fbb94c (plain) (blame)
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
name: "Reusable deploy on builds.joinpeertube.org"

description: "Reusable deploy on builds.joinpeertube.org"

inputs:
  source:
    required: true
    description: "Source file/files/directory/directories to deploy"
  destination:
    required: true
    description: "Destination directory on builds.joinpeertube.org"
  knownHosts:
    required: true
    description: "Known hosts"
  deployKey:
    required: true
    description: "Deploy key"
  deployUser:
    required: true
    description: "Deploy user"
  deployHost:
    required: true
    description: "Deploy host"


runs:
  using: "composite"

  steps:
    - name: "Deploy"
      shell: bash
      run: |
        mkdir -p ~/.ssh
        chmod 700  ~/.ssh

        echo "Adding ssh key to known hosts"
        echo -e "${{ inputs.knownHosts }}" > ~/.ssh/known_hosts;

        eval `ssh-agent -s`

        echo "Adding ssh deploy key"
        ssh-add <(echo "${{ inputs.deployKey }}");

        echo "Uploading files"

        scp ${{ inputs.source }} ${{ inputs.deployUser }}@${{ inputs.deployHost }}:../../web/${{ inputs.destination }};