@@ -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 }}
@@ -130,10 +172,17 @@ runs:
130172 TS_EXPERIMENT_OAUTH_AUTHKEY : true
131173 run : |
132174 if [ -z "${HOSTNAME}" ]; then
133- HOSTNAME="github-$(cat /etc/hostname)"
175+ if [ "{{ runner.os }}" == "Linux" ]; then
176+ HOSTNAME="github-$(cat /etc/hostname)"
177+ elif [ "{{ runner.os }}" == "Windows" ]; then
178+ HOSTNAME="github-$COMPUTERNAME"
179+ fi
134180 fi
135181 if [ -n "${{ inputs['oauth-secret'] }}" ]; then
136182 TAILSCALE_AUTHKEY="${{ inputs['oauth-secret'] }}?preauthorized=true&ephemeral=true"
137183 TAGS_ARG="--advertise-tags=${{ inputs.tags }}"
138184 fi
139- timeout --verbose --kill-after=1s ${TIMEOUT} sudo -E tailscale up ${TAGS_ARG} --authkey=${TAILSCALE_AUTHKEY} --hostname=${HOSTNAME} --accept-routes ${ADDITIONAL_ARGS}
185+ if [ "${{ runner.os }}" == "Linux" ]; then
186+ MAYBE_SUDO="sudo -E"
187+ fi
188+ timeout --verbose --kill-after=1s ${TIMEOUT} ${MAYBE_SUDO} tailscale up ${TAGS_ARG} --authkey=${TAILSCALE_AUTHKEY} --hostname=${HOSTNAME} --accept-routes ${ADDITIONAL_ARGS}
0 commit comments