-
Notifications
You must be signed in to change notification settings - Fork 2
101 lines (91 loc) · 2.78 KB
/
cd-scp.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# This is a basic workflow to help you get started with Actions
name: Sign and Distribute RPM Packages
# Controls when the workflow will run
on:
workflow_call:
inputs:
ENVIRONMENT:
required: false
type: string
description: Environment where the variables and secrets are scoped to
RUNNER:
required: false
default: ubuntu-latest
type: string
description: A GitHub runner type
ARTIFACT_NAME:
required: false
default: ''
description: The artifact name to pull from a previous step
type: string
FILES:
required: false
default: ''
description: The files that will be copied to a remote server
type: string
EXEC_COMMANDS:
required: false
default: ''
description: Commands to execute on remote host
type: string
TARGET_FOLDER:
required: false
default: ''
type: string
description: Target folder where the files should be sent on remote
TRANSFER_CONFIRMATION:
required: false
type: boolean
default: true
description: Uploads a confirmation file named ready.txt to ilustrate that the transfer has ended
CREATE_DESTINATION_FOLDERS:
required: false
default: false
description: Create folder on destination
type: boolean
secrets:
TELEPORT_TOKEN:
required: true
PROXY_URL:
required: true
HOSTNAME:
required: true
USERNAME:
required: true
jobs:
transfer:
runs-on: ${{ inputs.RUNNER }}
name: Copy files using tsh scp
environment: ${{ inputs.ENVIRONMENT }}
steps:
- name: Checkout actions
uses: actions/checkout@v4
with:
repository: signalwire/actions-template
ref: main
path: actions
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: ${{ inputs.ARTIFACT_NAME }}
- name: Create destination folders
uses: ./actions/.github/actions/teleport
if: inputs.CREATE_DESTINATION_FOLDERS == true
with:
EXEC_COMMANDS: mkdir -p ${{ inputs.TARGET_FOLDER }}
env:
USERNAME: ${{ secrets.USERNAME }}
HOSTNAME: ${{ secrets.HOSTNAME }}
PROXY_URL: ${{ secrets.PROXY_URL }}
TOKEN: ${{ secrets.TELEPORT_TOKEN }}
- name: Copy files to remote host
uses: ./actions/.github/actions/teleport
with:
FILES: ${{ inputs.FILES }}
EXEC_COMMANDS: ${{ inputs.EXEC_COMMANDS }}
FILES_FOLDER: ${{ inputs.TARGET_FOLDER }}
env:
USERNAME: ${{ secrets.USERNAME }}
HOSTNAME: ${{ secrets.HOSTNAME }}
PROXY_URL: ${{ secrets.PROXY_URL }}
TOKEN: ${{ secrets.TELEPORT_TOKEN }}