github-action/action.yml
M. J. Fromberger bf5e14e8ed
Ensure curl calls follow redirects. (#86)
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2023-08-25 16:49:26 -07:00

47 lines
1.6 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.14.0'
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 -H user-agent:tailscale-github-action-v1 -L "$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} --accept-routes
do
sleep 0.5
done