-
Notifications
You must be signed in to change notification settings - Fork 5
/
action.yml
106 lines (91 loc) · 3.41 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
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
102
103
104
105
106
# Define the GitHub Action
name: Pritunl Client GitHub Action
description: Establish automated secure Pritunl VPN connections with Pritunl Client in GitHub Actions, supporting OpenVPN and WireGuard.
# Define branding for the GitHub Marketplace
branding:
icon: server
color: gray-dark
# Define inputs for the Action
inputs:
profile-file:
description: Pritunl Profile Key file
required: true
default: ''
profile-pin:
description: Pritunl Profile PIN/Password
required: false
default: ''
profile-server:
description: Pritunl Profile Server (for specifying a particular server or multiple servers within a profile)
required: false
default: ''
vpn-mode:
description: VPN mode (ovpn for OpenVPN or wg for WireGuard)
required: false
default: 'ovpn'
client-version:
description: Pritunl Client version (defaults to package manager version)
required: false
default: 'from-package-manager'
start-connection:
description: Start VPN connection automatically (true/false)
required: false
default: 'true'
ready-profile-timeout:
description: Wait for Ready Profile timeout (seconds)
required: false
default: '3'
established-connection-timeout:
description: Wait for Established Connection timeout (seconds)
required: false
default: '30'
concealed-outputs:
description: Concealed Outputs (true/false)
required: false
default: 'true'
# Define outputs for the Action
outputs:
client-id:
description: Primary Client ID (string, bash variable)
value: ${{ steps.pritunl-client.outputs.client-id }}
client-ids:
description: All Client IDs and Names (JSON array)
value: ${{ steps.pritunl-client.outputs.client-ids }}
# Define the Action's workflow
runs:
using: "composite"
steps:
- name: Setup Pritunl Client
id: pritunl-client
env:
# Set environment variables for input values
PRITUNL_PROFILE_FILE: ${{ inputs.profile-file }}
PRITUNL_PROFILE_PIN: ${{ inputs.profile-pin }}
PRITUNL_PROFILE_SERVER: ${{ inputs.profile-server }}
PRITUNL_VPN_MODE: ${{ inputs.vpn-mode }}
PRITUNL_CLIENT_VERSION: ${{ inputs.client-version }}
PRITUNL_START_CONNECTION: ${{ inputs.start-connection }}
PRITUNL_READY_PROFILE_TIMEOUT: ${{ inputs.ready-profile-timeout }}
PRITUNL_ESTABLISHED_CONNECTION_TIMEOUT: ${{ inputs.established-connection-timeout }}
PRITUNL_CONCEALED_OUTPUTS: ${{ inputs.concealed-outputs }}
shell: bash
run: |
# main entry point for executing the 'pritunl-client.sh' script
# Define a function to determine the path separator based on the runner OS
os_path_separator() {
# Determine the path separator based on the runner OS
case "${RUNNER_OS}" in
Windows)
# Use a backslash (\) for Windows paths to avoid file name confusion
echo '\'
;;
*)
# Use a forward slash (/) for non-Windows OSes (Linux, macOS, etc.) for consistency
echo '/'
;;
esac
}
# Run the 'pritunl-client.sh' script using the dynamically constructed path
# The path is constructed by combining 'GITHUB_ACTION_PATH' with the appropriate path separator by OS
# and the script name 'pritunl-client.sh' to ensure correct script execution
${GITHUB_ACTION_PATH}$(os_path_separator)pritunl-client.sh