-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
80 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,32 @@ | ||
# wireguard-action | ||
Wireguard GitHub Action | ||
# wg-action | ||
|
||
WireGuard GitHub Action to access our internal registries from GitHub actions. | ||
|
||
## Setup | ||
|
||
This action requires you to define a set of input parameters. | ||
|
||
``` | ||
name: access-cluster | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
jobs: | ||
test_access_cluster: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install WG | ||
uses: promaton/wg-action@main | ||
with: | ||
interface_private_key: "${{ secrets.INTERFACE_PRIVATE_KEY }}" | ||
interface_address: "${{ secrets.INTERFACE_ADDRESS }}" | ||
peer_public_key: "${{ secrets.PEER_PUBLIC_KEY }}" | ||
peer_allowed_ips: "${{ secrets.PEER_ALLOWED_IPS }}" | ||
peer_endpoint: "${{ secrets.PEER_ENDPOINT }}" | ||
# Optional | ||
interface_dns: "${{ secrets.INTERFACE_DNS }}" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
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 | ||
cat tunnel.conf | ||
sudo cp tunnel.conf /etc/wireguard/ | ||
wg-quick up tunnel |