@@ -52,26 +52,26 @@ 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 }}
7272 run : |
7373 if [ "$VERSION" = "latest" ]; then
74- VERSION=$(curl -s "https://pkgs.tailscale.com/stable/?mode=json" | jq -r .Version)
74+ VERSION=$(curl -H user-agent:tailscale-github-action - s "https://pkgs.tailscale.com/stable/?mode=json" | jq -r .Version)
7575 echo "Latest Tailscale version: $VERSION"
7676 fi
7777 if [ ${{ runner.arch }} = "ARM64" ]; then
8080 TS_ARCH="arm"
8181 elif [ ${{ runner.arch }} = "X86" ]; then
8282 TS_ARCH="386"
83- elif [ ${{ runner.arch }} = "X64" ]; then
84- TS_ARCH="amd64"
8583 else
8684 TS_ARCH="amd64"
8785 fi
@@ -103,7 +101,47 @@ runs:
103101 rm tailscale.tgz
104102 TSPATH=/tmp/tailscale_${VERSION}_${TS_ARCH}
105103 sudo mv "${TSPATH}/tailscale" "${TSPATH}/tailscaled" /usr/bin
106- - name : Start Tailscale Daemon
104+ - name : Download Tailscale - Windows
105+ if : ${{ runner.os == 'Windows' }}
106+ shell : bash
107+ env :
108+ VERSION : ${{ inputs.version }}
109+ SHA256SUM : ${{ inputs.sha256sum }}
110+ 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
115+ if [ ${{ runner.arch }} = "ARM64" ]; then
116+ TS_ARCH="arm64"
117+ elif [ ${{ runner.arch }} = "X86" ]; then
118+ TS_ARCH="x86"
119+ else
120+ TS_ARCH="amd64"
121+ fi
122+ MINOR=$(echo "$VERSION" | awk -F '.' {'print $2'})
123+ if [ $((MINOR % 2)) -eq 0 ]; then
124+ URL="https://pkgs.tailscale.com/stable/tailscale-setup-${VERSION}-${TS_ARCH}.msi"
125+ else
126+ URL="https://pkgs.tailscale.com/unstable/tailscale-setup-${VERSION}-${TS_ARCH}.msi"
127+ fi
128+ echo "Downloading $URL"
129+ curl -H user-agent:tailscale-github-action -L "$URL" -o tailscale.msi --max-time 300 --fail
130+ if ! [[ "$SHA256SUM" ]] ; then
131+ SHA256SUM="$(curl -H user-agent:tailscale-github-action -L "${URL}.sha256" --fail)"
132+ fi
133+ echo "Expected sha256: $SHA256SUM"
134+ echo "Actual sha256: $(sha256sum tailscale.msi)"
135+ echo "$SHA256SUM tailscale.msi" | sha256sum -c
136+ - name : Install Tailscale - Windows
137+ if : ${{ runner.os == 'Windows' }}
138+ shell : pwsh
139+ run : |
140+ Start-Process "C:\Windows\System32\msiexec.exe" -Wait -ArgumentList @('/quiet', '/l*v tailscale.log', '/i', 'tailscale.msi')
141+ Add-Content $env:GITHUB_PATH "C:\Program Files\Tailscale\"
142+ Remove-Item tailscale.msi -Force;
143+ - name : Start Tailscale Daemon - Linux
144+ if : ${{ runner.os == 'Linux' }}
107145 shell : bash
108146 env :
109147 ADDITIONAL_DAEMON_ARGS : ${{ inputs.tailscaled-args }}
@@ -127,13 +165,19 @@ runs:
127165 HOSTNAME : ${{ inputs.hostname }}
128166 TAILSCALE_AUTHKEY : ${{ inputs.authkey }}
129167 TIMEOUT : ${{ inputs.timeout }}
130- TS_EXPERIMENT_OAUTH_AUTHKEY : true
131168 run : |
132169 if [ -z "${HOSTNAME}" ]; then
133- HOSTNAME="github-$(cat /etc/hostname)"
170+ if [ "${{ runner.os }}" == "Linux" ]; then
171+ HOSTNAME="github-$(cat /etc/hostname)"
172+ elif [ "${{ runner.os }}" == "Windows" ]; then
173+ HOSTNAME="github-$COMPUTERNAME"
174+ fi
134175 fi
135176 if [ -n "${{ inputs['oauth-secret'] }}" ]; then
136177 TAILSCALE_AUTHKEY="${{ inputs['oauth-secret'] }}?preauthorized=true&ephemeral=true"
137178 TAGS_ARG="--advertise-tags=${{ inputs.tags }}"
138179 fi
139- timeout --verbose --kill-after=1s ${TIMEOUT} sudo -E tailscale up ${TAGS_ARG} --authkey=${TAILSCALE_AUTHKEY} --hostname=${HOSTNAME} --accept-routes ${ADDITIONAL_ARGS}
180+ if [ "${{ runner.os }}" == "Linux" ]; then
181+ MAYBE_SUDO="sudo -E"
182+ fi
183+ timeout --verbose --kill-after=1s ${TIMEOUT} ${MAYBE_SUDO} tailscale up ${TAGS_ARG} --authkey=${TAILSCALE_AUTHKEY} --hostname=${HOSTNAME} --accept-routes ${ADDITIONAL_ARGS}
0 commit comments