github-action/action.yml
Harry Bowron fcb293e61e Revert "Rename action for marketplace"
This reverts commit 8c58b05477.
2021-11-12 16:12:52 +02:00

51 lines
1.7 KiB
YAML

# Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
name: 'Connect Tailscale'
description: 'Connect your GitHub Action workflow to Tailscale'
branding:
icon: 'arrow-right-circle'
color: 'gray-dark'
inputs:
authkey:
description: 'Your Tailscale authentication key, from the admin panel.'
required: true
version:
description: 'Tailscale version to use.'
required: true
default: '1.16.2'
args:
description: 'Optional additional arguments to `tailscale up`'
required: false
default: ''
runs:
using: 'composite'
steps:
- name: Download Tailscale
shell: bash
id: download
env:
VERSION: ${{ inputs.version }}
run: |
MINOR=$(echo "$VERSION" | awk -F '.' {'print $2'})
if [ $((MINOR % 2)) -eq 0 ]; then
URL="https://pkgs.tailscale.com/stable/tailscale_${VERSION}_amd64.tgz"
else
URL="https://pkgs.tailscale.com/unstable/tailscale_${VERSION}_amd64.tgz"
fi
curl "$URL" -o tailscale.tgz
tar -C /tmp -xzf tailscale.tgz
rm tailscale.tgz
TSPATH=/tmp/tailscale_${VERSION}_amd64
sudo mv "${TSPATH}/tailscale" "${TSPATH}/tailscaled" /usr/bin
- name: Run Tailscale
shell: bash
env:
TAILSCALE_AUTHKEY: ${{ inputs.authkey }}
run: |
sudo tailscaled 2>~/tailscaled.log &
HOSTNAME="github-$(cat /etc/hostname)"
until sudo tailscale up --authkey ${TAILSCALE_AUTHKEY} --hostname=${HOSTNAME} --accept-routes ${INPUTS_ARGS}
do
sleep 0.5
done