mirror of
https://github.com/tailscale/github-action.git
synced 2026-08-20 22:09:22 +00:00
support "unstable" version option on all platforms except macOS
The tailscale repo does not get tagged for unstable builds, so the best we can do when building macOS from source is to build from the HEAD of `main`. Updates tailscale/corp#32813 Signed-off-by: Percy Wegmann <percy@tailscale.com>
This commit is contained in:
parent
660d7be521
commit
cf94bd9cf6
4 changed files with 64 additions and 15 deletions
27
.github/workflows/test.yml
vendored
27
.github/workflows/test.yml
vendored
|
|
@ -11,7 +11,7 @@ jobs:
|
|||
# Matrix test for all supported platforms and architectures
|
||||
|
||||
integration-tests:
|
||||
name: Test ${{ matrix.os }} (${{ matrix.arch }})
|
||||
name: ${{ matrix.os }} (${{ matrix.arch }}) tailscale-${{ matrix.version }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
|
@ -20,31 +20,54 @@ jobs:
|
|||
- os: ubuntu-latest
|
||||
runner-os: Linux
|
||||
arch: amd64
|
||||
version: latest
|
||||
|
||||
# Try unstable too
|
||||
- os: ubuntu-latest
|
||||
runner-os: Linux
|
||||
arch: amd64
|
||||
version: unstable
|
||||
|
||||
# Try a pinned version
|
||||
- os: ubuntu-latest
|
||||
runner-os: Linux
|
||||
arch: amd64
|
||||
version: 1.82.0
|
||||
|
||||
# Linux tests (ARM64)
|
||||
- os: ubuntu-24.04-arm
|
||||
runner-os: Linux
|
||||
arch: arm64
|
||||
version: latest
|
||||
|
||||
# Windows tests (AMD64)
|
||||
- os: windows-latest
|
||||
runner-os: Windows
|
||||
arch: amd64
|
||||
version: latest
|
||||
|
||||
- os: windows-latest
|
||||
runner-os: Windows
|
||||
arch: amd64
|
||||
version: unstable
|
||||
|
||||
# Windows tests (ARM64)
|
||||
- os: windows-11-arm
|
||||
runner-os: Windows
|
||||
arch: arm64
|
||||
version: latest
|
||||
|
||||
# macOS intel
|
||||
- os: macos-13
|
||||
runner-os: macOS
|
||||
arch: amd64
|
||||
version: latest
|
||||
|
||||
# macOS ARM
|
||||
- os: macos-14
|
||||
runner-os: macOS
|
||||
arch: arm64
|
||||
version: latest
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
|
|
@ -72,7 +95,7 @@ jobs:
|
|||
oauth-client-id: ${{ secrets.TS_AUTH_KEYS_OAUTH_CLIENT_ID }}
|
||||
oauth-client-secret: ${{ secrets.TS_AUTH_KEYS_OAUTH_CLIENT_SECRET }}
|
||||
tags: "tag:ci"
|
||||
version: "1.82.0"
|
||||
version: "${{ matrix.version }}"
|
||||
use-cache: false
|
||||
timeout: "5m"
|
||||
retry: 3
|
||||
|
|
|
|||
2
Makefile
2
Makefile
|
|
@ -26,7 +26,7 @@ install:
|
|||
npm install
|
||||
|
||||
# Build the TypeScript code
|
||||
build: clean
|
||||
build: clean format
|
||||
npm run build
|
||||
|
||||
# Lint the TypeScript code
|
||||
|
|
|
|||
20
dist/index.js
vendored
20
dist/index.js
vendored
|
|
@ -41204,10 +41204,15 @@ async function run() {
|
|||
}
|
||||
// Get and validate inputs
|
||||
const config = await getInputs();
|
||||
if (runnerOS === "macOS" &&
|
||||
config.version === "unstable" &&
|
||||
config.useCache) {
|
||||
throw new Error("Caching of unstable releases is not supported on macOS runners");
|
||||
}
|
||||
// Validate authentication
|
||||
validateAuth(config);
|
||||
// Resolve version
|
||||
config.resolvedVersion = await resolveVersion(config.version);
|
||||
config.resolvedVersion = await resolveVersion(config.version, runnerOS);
|
||||
core.info(`Resolved Tailscale version: ${config.resolvedVersion}`);
|
||||
// Set architecture
|
||||
config.arch = getTailscaleArch(runnerOS);
|
||||
|
|
@ -41268,13 +41273,17 @@ function validateAuth(config) {
|
|||
throw new Error("OAuth identity empty, please provide either an auth key or OAuth secret and tags.");
|
||||
}
|
||||
}
|
||||
async function resolveVersion(version) {
|
||||
if (version === "latest") {
|
||||
async function resolveVersion(version, runnerOS) {
|
||||
if (runnerOS === "macOS" && version === "unstable") {
|
||||
return "main";
|
||||
}
|
||||
if (version === "latest" || version === "unstable") {
|
||||
let path = version === "unstable" ? "unstable" : "stable";
|
||||
const { stdout } = await exec.getExecOutput("curl", [
|
||||
"-H",
|
||||
"user-agent:action-setup-tailscale",
|
||||
"-s",
|
||||
"https://pkgs.tailscale.com/stable/?mode=json",
|
||||
`https://pkgs.tailscale.com/${path}/?mode=json`,
|
||||
]);
|
||||
const response = JSON.parse(stdout);
|
||||
return response.Version;
|
||||
|
|
@ -41656,8 +41665,7 @@ function sleep(ms) {
|
|||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
function generateCacheKey(config, runnerOS) {
|
||||
// Don't cache if version is latest or if caching is disabled
|
||||
if (config.resolvedVersion === "latest" || !config.useCache) {
|
||||
if (!config.useCache) {
|
||||
return undefined;
|
||||
}
|
||||
return `action-setup-tailscale/${config.resolvedVersion}/${runnerOS}-${config.arch}`;
|
||||
|
|
|
|||
30
src/main.ts
30
src/main.ts
|
|
@ -114,11 +114,21 @@ async function run(): Promise<void> {
|
|||
// Get and validate inputs
|
||||
const config = await getInputs();
|
||||
|
||||
if (
|
||||
runnerOS === "macOS" &&
|
||||
config.version === "unstable" &&
|
||||
config.useCache
|
||||
) {
|
||||
throw new Error(
|
||||
"Caching of unstable releases is not supported on macOS runners"
|
||||
);
|
||||
}
|
||||
|
||||
// Validate authentication
|
||||
validateAuth(config);
|
||||
|
||||
// Resolve version
|
||||
config.resolvedVersion = await resolveVersion(config.version);
|
||||
config.resolvedVersion = await resolveVersion(config.version, runnerOS);
|
||||
core.info(`Resolved Tailscale version: ${config.resolvedVersion}`);
|
||||
|
||||
// Set architecture
|
||||
|
|
@ -186,17 +196,26 @@ function validateAuth(config: TailscaleConfig): void {
|
|||
}
|
||||
}
|
||||
|
||||
async function resolveVersion(version: string): Promise<string> {
|
||||
if (version === "latest") {
|
||||
async function resolveVersion(
|
||||
version: string,
|
||||
runnerOS: string
|
||||
): Promise<string> {
|
||||
if (runnerOS === "macOS" && version === "unstable") {
|
||||
return "main";
|
||||
}
|
||||
|
||||
if (version === "latest" || version === "unstable") {
|
||||
let path = version === "unstable" ? "unstable" : "stable";
|
||||
const { stdout } = await exec.getExecOutput("curl", [
|
||||
"-H",
|
||||
"user-agent:action-setup-tailscale",
|
||||
"-s",
|
||||
"https://pkgs.tailscale.com/stable/?mode=json",
|
||||
`https://pkgs.tailscale.com/${path}/?mode=json`,
|
||||
]);
|
||||
const response = JSON.parse(stdout);
|
||||
return response.Version;
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
|
|
@ -665,8 +684,7 @@ function generateCacheKey(
|
|||
config: TailscaleConfig,
|
||||
runnerOS: string
|
||||
): string | undefined {
|
||||
// Don't cache if version is latest or if caching is disabled
|
||||
if (config.resolvedVersion === "latest" || !config.useCache) {
|
||||
if (!config.useCache) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue