-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
47 lines (46 loc) · 1.48 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
name: 'WireGuard'
description: 'Connect a WireGuard VPN client for a GitHub Actions runner'
branding:
icon: 'lock'
color: 'red'
inputs:
interface_private_key:
description: "The interface private key"
required: true
interface_address:
description: "The interface address"
required: true
interface_dns:
description: "The interface DNS"
required: false
peer_public_key:
description: "The peer public key"
required: true
peer_allowed_ips:
description: "The peer allowed IPs"
required: true
peer_endpoint:
description: "The peer endpoint"
required: true
runs:
using: "composite"
steps:
- name: Install wireguard
shell: bash
run: sudo apt-get install wireguard openresolv
- name: Create wireguard tunnel configuration
shell: bash
run: |
touch tunnel.conf
echo "[Interface]" >> tunnel.conf
echo "PrivateKey = ${{ inputs.interface_private_key }}" >> tunnel.conf
echo "Address = ${{ inputs.interface_address }}" >> tunnel.conf
if [ -n "${{ inputs.interface_dns }}" ]; then
echo "DNS = ${{ inputs.interface_dns }}" >> tunnel.conf
fi
echo -e "\n[Peer]" >> tunnel.conf
echo "PublicKey = ${{ inputs.peer_public_key }}" >> tunnel.conf
echo "AllowedIPs = ${{ inputs.peer_allowed_ips }}" >> tunnel.conf
echo "Endpoint = ${{ inputs.peer_endpoint }}" >> tunnel.conf
sudo cp tunnel.conf /etc/wireguard/
wg-quick up tunnel