@@ -52,20 +52,20 @@ runs:
5252 using : ' composite'
5353 steps :
5454 - name : Check Runner OS
55- if : ${{ runner.os != 'Linux' }}
55+ if : ${{ runner.os != 'Linux' && runner.os != 'Windows' }}
5656 shell : bash
5757 run : |
58- echo "::error title=⛔ error hint::Support Linux Only"
58+ echo "::error title=⛔ error hint::Support Linux or Windows 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 : Download Tailscale
66+ - name : Download Tailscale - Linux
67+ if : ${{ runner.os == 'Linux' }}
6768 shell : bash
68- id : download
6969 env :
7070 VERSION : ${{ inputs.version }}
7171 SHA256SUM : ${{ inputs.sha256sum }}
@@ -103,7 +103,49 @@ runs:
103103 rm tailscale.tgz
104104 TSPATH=/tmp/tailscale_${VERSION}_${TS_ARCH}
105105 sudo mv "${TSPATH}/tailscale" "${TSPATH}/tailscaled" /usr/bin
106- - name : Start Tailscale Daemon
106+ - name : Download Tailscale - Windows
107+ if : ${{ runner.os == 'Windows' }}
108+ shell : bash
109+ env :
110+ VERSION : ${{ inputs.version }}
111+ SHA256SUM : ${{ inputs.sha256sum }}
112+ run : |
113+ if [ "$VERSION" = "latest" ]; then
114+ VERSION=$(curl -s "https://pkgs.tailscale.com/stable/?mode=json" | jq -r .Version)
115+ echo "Latest Tailscale version: $VERSION"
116+ fi
117+ if [ X64 = "ARM64" ]; then
118+ TS_ARCH="arm64"
119+ elif [ X64 = "X86" ]; then
120+ TS_ARCH="x86"
121+ elif [ X64 = "X64" ]; then
122+ TS_ARCH="amd64"
123+ else
124+ TS_ARCH="amd64"
125+ fi
126+ MINOR=$(echo "$VERSION" | awk -F '.' {'print $2'})
127+ if [ $((MINOR % 2)) -eq 0 ]; then
128+ URL="https://pkgs.tailscale.com/stable/tailscale-setup-${VERSION}-${TS_ARCH}.msi"
129+ else
130+ URL="https://pkgs.tailscale.com/unstable/tailscale-setup-${VERSION}-${TS_ARCH}.msi"
131+ fi
132+ echo "Downloading $URL"
133+ curl -H user-agent:tailscale-github-action -L "$URL" -o tailscale.msi --max-time 300 --fail
134+ if ! [[ "$SHA256SUM" ]] ; then
135+ SHA256SUM="$(curl -H user-agent:tailscale-github-action -L "${URL}.sha256" --fail)"
136+ fi
137+ echo "Expected sha256: $SHA256SUM"
138+ echo "Actual sha256: $(sha256sum tailscale.msi)"
139+ echo "$SHA256SUM tailscale.msi" | sha256sum -c
140+ - name : Install Tailscale - Windows
141+ if : ${{ runner.os == 'Windows' }}
142+ shell : pwsh
143+ run : |
144+ Start-Process "C:\Windows\System32\msiexec.exe" -Wait -ArgumentList @('/quiet', '/l*v tailscale.log', '/i', 'tailscale.msi')
145+ Add-Content $env:GITHUB_PATH "C:\Program Files\Tailscale\"
146+ Remove-Item tailscale.msi -Force;
147+ - name : Start Tailscale Daemon - Linux
148+ if : ${{ runner.os == 'Linux' }}
107149 shell : bash
108150 env :
109151 ADDITIONAL_DAEMON_ARGS : ${{ inputs.tailscaled-args }}
@@ -120,7 +162,8 @@ runs:
120162 # for it. And --json will make it exit with status 0 even if we're logged
121163 # out (as we will be). Without --json it returns an error if we're not up.
122164 sudo -E tailscale status --json >/dev/null
123- - name : Connect to Tailscale
165+ - name : Connect to Tailscale - Linux
166+ if : ${{ runner.os == 'Linux' }}
124167 shell : bash
125168 env :
126169 ADDITIONAL_ARGS : ${{ inputs.args }}
@@ -137,3 +180,21 @@ runs:
137180 TAGS_ARG="--advertise-tags=${{ inputs.tags }}"
138181 fi
139182 timeout --verbose --kill-after=1s ${TIMEOUT} sudo -E tailscale up ${TAGS_ARG} --authkey=${TAILSCALE_AUTHKEY} --hostname=${HOSTNAME} --accept-routes ${ADDITIONAL_ARGS}
183+ - name : Connect to Tailscale - Windows
184+ if : ${{ runner.os == 'Windows' }}
185+ shell : bash
186+ env :
187+ ADDITIONAL_ARGS : ${{ inputs.args }}
188+ HOSTNAME : ${{ inputs.hostname }}
189+ TAILSCALE_AUTHKEY : ${{ inputs.authkey }}
190+ TIMEOUT : ${{ inputs.timeout }}
191+ TS_EXPERIMENT_OAUTH_AUTHKEY : true
192+ run : |
193+ if [ -z "${HOSTNAME}" ]; then
194+ HOSTNAME="github-$(cat /etc/hostname)"
195+ fi
196+ if [ -n "${{ inputs['oauth-secret'] }}" ]; then
197+ TAILSCALE_AUTHKEY="${{ inputs['oauth-secret'] }}?preauthorized=true&ephemeral=true"
198+ TAGS_ARG="--advertise-tags=${{ inputs.tags }}"
199+ fi
200+ timeout --verbose --kill-after=1s ${TIMEOUT} tailscale up ${TAGS_ARG} --authkey=${TAILSCALE_AUTHKEY} --hostname=${HOSTNAME} --accept-routes ${ADDITIONAL_ARGS}
0 commit comments