From 7af1b1f12d86c5c912a534d67a838b9836ae5b25 Mon Sep 17 00:00:00 2001 From: Lee Briggs Date: Sun, 7 Jul 2024 08:57:21 -0700 Subject: [PATCH 1/6] find latest version Signed-off-by: Lee Briggs --- action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index a3bbe04..0ccd460 100644 --- a/action.yml +++ b/action.yml @@ -23,7 +23,7 @@ inputs: version: description: 'Tailscale version to use.' required: true - default: '1.66.3' + default: 'latest' sha256sum: description: 'Expected SHA256 checksum of the tarball.' required: false @@ -62,6 +62,10 @@ runs: VERSION: ${{ inputs.version }} SHA256SUM: ${{ inputs.sha256sum }} run: | + if [ "$VERSION" = "latest" ]; then + VERSION=$(curl -s https://pkgs.tailscale.com/stable/ | grep -o 'value="[0-9.]*"' | sed 's/value="//;s/"//' | sort -V | tail -n 1) + echo "Latest Tailscale version: $VERSION" + fi if [ ${{ runner.arch }} = "ARM64" ]; then TS_ARCH="arm64" elif [ ${{ runner.arch }} = "ARM" ]; then From 408d716839bb0f8a62018c48edcd5a64bc9d3400 Mon Sep 17 00:00:00 2001 From: Lee Briggs Date: Sun, 7 Jul 2024 09:30:32 -0700 Subject: [PATCH 2/6] don't set default to latest Signed-off-by: Lee Briggs --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 0ccd460..1bfc41a 100644 --- a/action.yml +++ b/action.yml @@ -21,9 +21,9 @@ inputs: description: 'Comma separated list of Tags to be applied to nodes. The OAuth client must have permission to apply these tags.' required: false version: - description: 'Tailscale version to use.' + description: 'Tailscale version to use. Specify `latest` to use the latest stable version.' required: true - default: 'latest' + default: '1.66.3' sha256sum: description: 'Expected SHA256 checksum of the tarball.' required: false From 0eefde4707b1200556ed6db619fd2d209d3bad3d Mon Sep 17 00:00:00 2001 From: Lee Briggs Date: Sun, 7 Jul 2024 09:32:46 -0700 Subject: [PATCH 3/6] don't lookup latest version Signed-off-by: Lee Briggs --- action.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/action.yml b/action.yml index 1bfc41a..6231539 100644 --- a/action.yml +++ b/action.yml @@ -62,10 +62,6 @@ runs: VERSION: ${{ inputs.version }} SHA256SUM: ${{ inputs.sha256sum }} run: | - if [ "$VERSION" = "latest" ]; then - VERSION=$(curl -s https://pkgs.tailscale.com/stable/ | grep -o 'value="[0-9.]*"' | sed 's/value="//;s/"//' | sort -V | tail -n 1) - echo "Latest Tailscale version: $VERSION" - fi if [ ${{ runner.arch }} = "ARM64" ]; then TS_ARCH="arm64" elif [ ${{ runner.arch }} = "ARM" ]; then From c688cd1540188ec187964b96578a776c71b98136 Mon Sep 17 00:00:00 2001 From: Lee Briggs Date: Sun, 7 Jul 2024 09:50:18 -0700 Subject: [PATCH 4/6] Revert "don't lookup latest version" This reverts commit 0eefde4707b1200556ed6db619fd2d209d3bad3d. --- action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/action.yml b/action.yml index 6231539..1bfc41a 100644 --- a/action.yml +++ b/action.yml @@ -62,6 +62,10 @@ runs: VERSION: ${{ inputs.version }} SHA256SUM: ${{ inputs.sha256sum }} run: | + if [ "$VERSION" = "latest" ]; then + VERSION=$(curl -s https://pkgs.tailscale.com/stable/ | grep -o 'value="[0-9.]*"' | sed 's/value="//;s/"//' | sort -V | tail -n 1) + echo "Latest Tailscale version: $VERSION" + fi if [ ${{ runner.arch }} = "ARM64" ]; then TS_ARCH="arm64" elif [ ${{ runner.arch }} = "ARM" ]; then From 42b6960a760217c0326b7cc6407b9df558816618 Mon Sep 17 00:00:00 2001 From: Lee Briggs Date: Sun, 7 Jul 2024 09:52:20 -0700 Subject: [PATCH 5/6] update readme Signed-off-by: Lee Briggs --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 34c28ba..646f1f6 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ with any of the Users on the tailnet, it has to Tag its nodes. Nodes created by this Action are [marked as Ephemeral](https://tailscale.com/s/ephemeral-nodes) to be automatically removed by the coordination server a short time after they finish their run. The nodes are also [marked Preapproved](https://tailscale.com/kb/1085/auth-keys/) -on tailnets which use [Device Approval](https://tailscale.com/kb/1099/device-approval/) +on Tailnets which use [Device Approval](https://tailscale.com/kb/1099/device-approval/) ## Defining Tailscale version @@ -41,5 +41,17 @@ Which Tailscale version to use can be set like this: version: 1.52.0 ``` +If you'd like to specify the latest version, simply set the version as `latest` + +```yaml + - name: Tailscale + uses: tailscale/github-action@v2 + with: + oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} + oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} + tags: tag:ci + version: latest +``` + You can find the latest Tailscale stable version number at https://pkgs.tailscale.com/stable/#static. From cb0029737d225a001316554e9b3836eda9ef8614 Mon Sep 17 00:00:00 2001 From: Lee Briggs Date: Thu, 12 Dec 2024 12:36:42 +0000 Subject: [PATCH 6/6] use json api for getting latest version --- README.md | 2 +- action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 646f1f6..057935a 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ with any of the Users on the tailnet, it has to Tag its nodes. Nodes created by this Action are [marked as Ephemeral](https://tailscale.com/s/ephemeral-nodes) to be automatically removed by the coordination server a short time after they finish their run. The nodes are also [marked Preapproved](https://tailscale.com/kb/1085/auth-keys/) -on Tailnets which use [Device Approval](https://tailscale.com/kb/1099/device-approval/) +on tailnets which use [Device Approval](https://tailscale.com/kb/1099/device-approval/) ## Defining Tailscale version diff --git a/action.yml b/action.yml index 1bfc41a..d5c25de 100644 --- a/action.yml +++ b/action.yml @@ -63,7 +63,7 @@ runs: SHA256SUM: ${{ inputs.sha256sum }} run: | if [ "$VERSION" = "latest" ]; then - VERSION=$(curl -s https://pkgs.tailscale.com/stable/ | grep -o 'value="[0-9.]*"' | sed 's/value="//;s/"//' | sort -V | tail -n 1) + VERSION=$(curl -s "https://pkgs.tailscale.com/stable/?mode=json" | jq -r .Version) echo "Latest Tailscale version: $VERSION" fi if [ ${{ runner.arch }} = "ARM64" ]; then