setup-uv/src/update-known-versions.ts
Kevin Stillhammer a4f1f549e9
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Release Drafter / ✏️ Draft release (push) Waiting to run
test / lint (push) Waiting to run
test / test-default-version (macos-14) (push) Waiting to run
test / test-default-version (macos-latest) (push) Waiting to run
test / test-default-version (ubuntu-latest) (push) Waiting to run
test / test-default-version (windows-latest) (push) Waiting to run
test / test-specific-version (0.3) (push) Waiting to run
test / test-specific-version (0.3.0) (push) Waiting to run
test / test-specific-version (0.3.2) (push) Waiting to run
test / test-specific-version (0.3.x) (push) Waiting to run
test / test-specific-version (>=0.3.0) (push) Waiting to run
test / test-semver-range (selfhosted-ubuntu-arm64) (push) Waiting to run
test / test-semver-range (ubuntu-latest) (push) Waiting to run
test / test-pep440-version (push) Waiting to run
test / test-pyproject-file-version (push) Waiting to run
test / test-malformed-pyproject-file-fallback (push) Waiting to run
test / test-uv-file-version (push) Waiting to run
test / test-checksum (map[checksum:4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd os:ubuntu-latest]) (push) Waiting to run
test / test-checksum (map[checksum:a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218 os:macos-latest]) (push) Waiting to run
test / test-with-explicit-token (push) Waiting to run
test / test-uvx (push) Waiting to run
test / test-tool-install (macos-14) (push) Waiting to run
test / test-tool-install (macos-latest) (push) Waiting to run
test / test-tool-install (ubuntu-latest) (push) Waiting to run
test / test-tool-install (windows-latest) (push) Waiting to run
test / test-tilde-expansion-tool-dirs (push) Waiting to run
test / test-python-version (macos-latest) (push) Waiting to run
test / test-python-version (ubuntu-latest) (push) Waiting to run
test / test-python-version (windows-latest) (push) Waiting to run
test / test-activate-environment (macos-latest) (push) Waiting to run
test / test-activate-environment (ubuntu-latest) (push) Waiting to run
test / test-activate-environment (windows-latest) (push) Waiting to run
test / test-musl (push) Waiting to run
test / test-setup-cache (auto, selfhosted-ubuntu-arm64) (push) Waiting to run
test / test-setup-cache (auto, ubuntu-latest) (push) Waiting to run
test / test-setup-cache (auto, windows-latest) (push) Waiting to run
test / test-setup-cache (false, selfhosted-ubuntu-arm64) (push) Waiting to run
test / test-setup-cache (false, ubuntu-latest) (push) Waiting to run
test / test-setup-cache (false, windows-latest) (push) Waiting to run
test / test-setup-cache (true, selfhosted-ubuntu-arm64) (push) Waiting to run
test / test-setup-cache (true, ubuntu-latest) (push) Waiting to run
test / test-setup-cache (true, windows-latest) (push) Waiting to run
test / test-restore-cache (auto, selfhosted-ubuntu-arm64) (push) Blocked by required conditions
test / test-restore-cache (auto, ubuntu-latest) (push) Blocked by required conditions
test / test-restore-cache (auto, windows-latest) (push) Blocked by required conditions
test / test-restore-cache (false, selfhosted-ubuntu-arm64) (push) Blocked by required conditions
test / test-restore-cache (false, ubuntu-latest) (push) Blocked by required conditions
test / test-restore-cache (false, windows-latest) (push) Blocked by required conditions
test / test-restore-cache (true, selfhosted-ubuntu-arm64) (push) Blocked by required conditions
test / test-restore-cache (true, ubuntu-latest) (push) Blocked by required conditions
test / test-restore-cache (true, windows-latest) (push) Blocked by required conditions
test / test-setup-cache-requirements-txt (push) Waiting to run
test / test-restore-cache-requirements-txt (push) Blocked by required conditions
test / test-setup-cache-dependency-glob (push) Waiting to run
test / test-restore-cache-dependency-glob (push) Blocked by required conditions
test / test-cache-local (map[expected-cache-dir:/home/runner/work/_temp/setup-uv-cache os:ubuntu-latest]) (push) Waiting to run
test / test-cache-local (map[expected-cache-dir:/home/ubuntu/.cache/uv os:selfhosted-ubuntu-arm64]) (push) Waiting to run
test / test-cache-local (map[expected-cache-dir:D:\a\_temp\setup-uv-cache os:windows-latest]) (push) Waiting to run
test / test-setup-cache-local (push) Waiting to run
test / test-restore-cache-local (push) Blocked by required conditions
test / test-tilde-expansion-cache-local-path (push) Waiting to run
test / test-tilde-expansion-cache-dependency-glob (push) Waiting to run
test / cleanup-tilde-expansion-tests (push) Blocked by required conditions
test / test-no-python-version (push) Waiting to run
test / all-tests-passed (push) Blocked by required conditions
Create version-manifest.json on uv release (#399)
2025-05-03 19:51:16 +02:00

60 lines
1.8 KiB
TypeScript

import * as semver from "semver";
import * as core from "@actions/core";
import { Octokit } from "./utils/octokit";
import { OWNER, REPO } from "./utils/constants";
import { updateChecksums } from "./download/checksum/update-known-checksums";
import {
updateVersionManifest,
getLatestKnownVersion,
} from "./download/version-manifest";
async function run(): Promise<void> {
const checksumFilePath = process.argv.slice(2)[0];
const versionsManifestFilePath = process.argv.slice(2)[1];
const githubToken = process.argv.slice(2)[2];
const octokit = new Octokit({
auth: githubToken,
});
const { data: latestRelease } = await octokit.rest.repos.getLatestRelease({
owner: OWNER,
repo: REPO,
});
const latestKnownVersion = await getLatestKnownVersion(
versionsManifestFilePath,
);
if (semver.lte(latestRelease.tag_name, latestKnownVersion)) {
core.info(
`Latest release (${latestRelease.tag_name}) is not newer than the latest known version (${latestKnownVersion}). Skipping update.`,
);
return;
}
const releases = await octokit.paginate(octokit.rest.repos.listReleases, {
owner: OWNER,
repo: REPO,
});
const checksumDownloadUrls: string[] = releases.flatMap((release) =>
release.assets
.filter((asset) => asset.name.endsWith(".sha256"))
.map((asset) => asset.browser_download_url),
);
await updateChecksums(checksumFilePath, checksumDownloadUrls);
const artifactDownloadUrls: string[] = releases.flatMap((release) =>
release.assets
.filter((asset) => !asset.name.endsWith(".sha256"))
.map((asset) => asset.browser_download_url),
);
await updateVersionManifest(versionsManifestFilePath, artifactDownloadUrls);
core.setOutput("latest-version", latestRelease.tag_name);
}
run();