github-action/action.yml
Denton Gentry bcb5c5a38e Update to 1.12.3 and tweak startup loop.
Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2021-08-05 20:23:53 -07:00

44 lines
1.5 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'
inputs:
authkey:
description: 'Your Tailscale authentication key, from the admin panel.'
required: true
version:
description: 'Tailscale version to use.'
required: true
default: '1.12.3'
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 ${HOME} -xzf tailscale.tgz
rm tailscale.tgz
TSPATH=${HOME}/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}
do
sleep 0.25
done