@@ -52,28 +52,34 @@ runs:
5252 using : ' composite'
5353 steps :
5454 - name : Check Runner OS
55- if : ${{ runner.os != 'Linux' && runner.os != 'Windows' }}
55+ if : ${{ runner.os != 'Linux' && runner.os != 'Windows' && runner.os != 'macOS' }}
5656 shell : bash
5757 run : |
58- echo "::error title=⛔ error hint::Support Linux or Windows Only"
58+ echo "::error title=⛔ error hint::Support Linux, Windows, and macOS Only"
5959 exit 1
6060 - name : Check Auth Info Empty
6161 if : ${{ inputs.authkey == '' && (inputs['oauth-secret'] == '' || inputs.tags == '') }}
6262 shell : bash
6363 run : |
6464 echo "::error title=⛔ error hint::OAuth identity empty, Maybe you need to populate it in the Secrets for your workflow, see more in https://docs.github.com/en/actions/security-guides/encrypted-secrets and https://tailscale.com/s/oauth-clients"
6565 exit 1
66+ - name : Set Resolved Version
67+ shell : bash
68+ run : |
69+ VERSION=${{ inputs.version }}
70+ if [ "$VERSION" = "latest" ]; then
71+ RESOLVED_VERSION=$(curl -H user-agent:tailscale-github-action -s "https://pkgs.tailscale.com/stable/?mode=json" | jq -r .Version)
72+ else
73+ RESOLVED_VERSION=$VERSION
74+ fi
75+ echo "RESOLVED_VERSION=$RESOLVED_VERSION" >> $GITHUB_ENV
76+ echo "Resolved Tailscale version: $RESOLVED_VERSION"
6677 - name : Download Tailscale - Linux
6778 if : ${{ runner.os == 'Linux' }}
6879 shell : bash
6980 env :
70- VERSION : ${{ inputs.version }}
7181 SHA256SUM : ${{ inputs.sha256sum }}
7282 run : |
73- if [ "$VERSION" = "latest" ]; then
74- VERSION=$(curl -H user-agent:tailscale-github-action -s "https://pkgs.tailscale.com/stable/?mode=json" | jq -r .Version)
75- echo "Latest Tailscale version: $VERSION"
76- fi
7783 if [ ${{ runner.arch }} = "ARM64" ]; then
7884 TS_ARCH="arm64"
7985 elif [ ${{ runner.arch }} = "ARM" ]; then
@@ -83,11 +89,11 @@ runs:
8389 else
8490 TS_ARCH="amd64"
8591 fi
86- MINOR=$(echo "$VERSION " | awk -F '.' {'print $2'})
92+ MINOR=$(echo "$RESOLVED_VERSION " | awk -F '.' {'print $2'})
8793 if [ $((MINOR % 2)) -eq 0 ]; then
88- URL="https://pkgs.tailscale.com/stable/tailscale_${VERSION }_${TS_ARCH}.tgz"
94+ URL="https://pkgs.tailscale.com/stable/tailscale_${$RESOLVED_VERSION }_${TS_ARCH}.tgz"
8995 else
90- URL="https://pkgs.tailscale.com/unstable/tailscale_${VERSION }_${TS_ARCH}.tgz"
96+ URL="https://pkgs.tailscale.com/unstable/tailscale_${$RESOLVED_VERSION }_${TS_ARCH}.tgz"
9197 fi
9298 echo "Downloading $URL"
9399 curl -H user-agent:tailscale-github-action -L "$URL" -o tailscale.tgz --max-time 300 --fail
@@ -99,31 +105,26 @@ runs:
99105 echo "$SHA256SUM tailscale.tgz" | sha256sum -c
100106 tar -C /tmp -xzf tailscale.tgz
101107 rm tailscale.tgz
102- TSPATH=/tmp/tailscale_${VERSION }_${TS_ARCH}
108+ TSPATH=/tmp/tailscale_${$RESOLVED_VERSION }_${TS_ARCH}
103109 sudo mv "${TSPATH}/tailscale" "${TSPATH}/tailscaled" /usr/bin
104110 - name : Download Tailscale - Windows
105111 if : ${{ runner.os == 'Windows' }}
106112 shell : bash
107113 env :
108- VERSION : ${{ inputs.version }}
109114 SHA256SUM : ${{ inputs.sha256sum }}
110115 run : |
111- if [ "$VERSION" = "latest" ]; then
112- VERSION=$(curl -H user-agent:tailscale-github-action -s "https://pkgs.tailscale.com/stable/?mode=json" | jq -r .Version)
113- echo "Latest Tailscale version: $VERSION"
114- fi
115116 if [ ${{ runner.arch }} = "ARM64" ]; then
116117 TS_ARCH="arm64"
117118 elif [ ${{ runner.arch }} = "X86" ]; then
118119 TS_ARCH="x86"
119120 else
120121 TS_ARCH="amd64"
121122 fi
122- MINOR=$(echo "$VERSION " | awk -F '.' {'print $2'})
123+ MINOR=$(echo "$RESOLVED_VERSION " | awk -F '.' {'print $2'})
123124 if [ $((MINOR % 2)) -eq 0 ]; then
124- URL="https://pkgs.tailscale.com/stable/tailscale-setup-${VERSION }-${TS_ARCH}.msi"
125+ URL="https://pkgs.tailscale.com/stable/tailscale-setup-${RESOLVED_VERSION }-${TS_ARCH}.msi"
125126 else
126- URL="https://pkgs.tailscale.com/unstable/tailscale-setup-${VERSION }-${TS_ARCH}.msi"
127+ URL="https://pkgs.tailscale.com/unstable/tailscale-setup-${RESOLVED_VERSION }-${TS_ARCH}.msi"
127128 fi
128129 echo "Downloading $URL"
129130 curl -H user-agent:tailscale-github-action -L "$URL" -o tailscale.msi --max-time 300 --fail
@@ -140,8 +141,29 @@ runs:
140141 Start-Process "C:\Windows\System32\msiexec.exe" -Wait -ArgumentList @('/quiet', '/l*v tailscale.log', '/i', 'tailscale.msi')
141142 Add-Content $env:GITHUB_PATH "C:\Program Files\Tailscale\"
142143 Remove-Item tailscale.msi -Force;
143- - name : Start Tailscale Daemon - Linux
144- if : ${{ runner.os == 'Linux' }}
144+ - name : Checkout Tailscale repo - macOS
145+ if : ${{ runner.os == 'macOS' }}
146+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
147+ with :
148+ repository : tailscale/tailscale
149+ path : ${{ github.workspace }}/tailscale
150+ ref : v${{ env.RESOLVED_VERSION }}
151+ - name : Build Tailscale binaries - macOS
152+ if : ${{ runner.os == 'macOS' }}
153+ shell : bash
154+ run : |
155+ cd tailscale
156+ export TS_USE_TOOLCHAIN=1
157+ ./build_dist.sh ./cmd/tailscale
158+ ./build_dist.sh ./cmd/tailscaled
159+ sudo mv tailscale tailscaled /usr/local/bin
160+ - name : Install timeout - macOS
161+ if : ${{ runner.os == 'macOS' }}
162+ shell : bash
163+ run :
164+ brew install coreutils # for 'timeout'
165+ - name : Start Tailscale Daemon - non-Windows
166+ if : ${{ runner.os != 'Windows' }}
145167 shell : bash
146168 env :
147169 ADDITIONAL_DAEMON_ARGS : ${{ inputs.tailscaled-args }}
@@ -153,7 +175,7 @@ runs:
153175 STATE_ARGS="--statedir=${STATEDIR}"
154176 mkdir -p "$STATEDIR"
155177 fi
156- sudo -E tailscaled ${STATE_ARGS} ${ADDITIONAL_DAEMON_ARGS} 2>~/tailscaled.log &
178+ sudo -E tailscaled ${STATE_ARGS} ${ADDITIONAL_DAEMON_ARGS} 2>&1 | tee ~/tailscaled.log &
157179 # And check that tailscaled came up. The CLI will block for a bit waiting
158180 # for it. And --json will make it exit with status 0 even if we're logged
159181 # out (as we will be). Without --json it returns an error if we're not up.
@@ -167,17 +189,17 @@ runs:
167189 TIMEOUT : ${{ inputs.timeout }}
168190 run : |
169191 if [ -z "${HOSTNAME}" ]; then
170- if [ "${{ runner.os }}" == "Linux" ]; then
171- HOSTNAME="github-$(cat /etc/hostname)"
172- elif [ "${{ runner.os }}" == "Windows" ]; then
192+ if [ "${{ runner.os }}" == "Windows" ]; then
173193 HOSTNAME="github-$COMPUTERNAME"
194+ else
195+ HOSTNAME="github-$(hostname)"
174196 fi
175197 fi
176198 if [ -n "${{ inputs['oauth-secret'] }}" ]; then
177199 TAILSCALE_AUTHKEY="${{ inputs['oauth-secret'] }}?preauthorized=true&ephemeral=true"
178200 TAGS_ARG="--advertise-tags=${{ inputs.tags }}"
179201 fi
180- if [ "${{ runner.os }}" == "Linux " ]; then
202+ if [ "${{ runner.os }}" != "Windows " ]; then
181203 MAYBE_SUDO="sudo -E"
182204 fi
183205 timeout --verbose --kill-after=1s ${TIMEOUT} ${MAYBE_SUDO} tailscale up ${TAGS_ARG} --authkey=${TAILSCALE_AUTHKEY} --hostname=${HOSTNAME} --accept-routes ${ADDITIONAL_ARGS}
0 commit comments