add hints
This commit is contained in:
Vendored
+1
-2
@@ -38,11 +38,10 @@ async function selectBranch(branch) {
|
|||||||
throw new Error(`Branch ${branch} not found`);
|
throw new Error(`Branch ${branch} not found`);
|
||||||
}
|
}
|
||||||
async function selectPr(pr) {
|
async function selectPr(pr) {
|
||||||
var _a;
|
|
||||||
const versions = await git_1.lsRemote();
|
const versions = await git_1.lsRemote();
|
||||||
if (pr in versions.pull) {
|
if (pr in versions.pull) {
|
||||||
const prheads = versions.pull[pr];
|
const prheads = versions.pull[pr];
|
||||||
const sha = (_a = prheads.merge) !== null && _a !== void 0 ? _a : prheads.head;
|
const sha = prheads.head;
|
||||||
if (sha) {
|
if (sha) {
|
||||||
return new VersionImpl(`#${pr}`, sha, 'pull', `pull request #${pr}`);
|
return new VersionImpl(`#${pr}`, sha, 'pull', `pull request #${pr}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+10
-7
@@ -7,16 +7,12 @@ const toolCache = require("@actions/tool-cache");
|
|||||||
const os = require("os");
|
const os = require("os");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const semver = require("semver");
|
const semver = require("semver");
|
||||||
async function winInstall(version) {
|
function getInstallerUrl(version) {
|
||||||
const ver = version.version;
|
const ver = version.version;
|
||||||
let toolDir = toolCache.find('xmake', ver);
|
|
||||||
if (!toolDir) {
|
|
||||||
const installer = await core.group(`download xmake ${version}`, async () => {
|
|
||||||
let url = '';
|
|
||||||
if (version.type === 'heads') {
|
if (version.type === 'heads') {
|
||||||
// we only use appveyor ci artifacts for branch version
|
// we only use appveyor ci artifacts for branch version
|
||||||
const arch = os.arch() === 'x64' ? 'x64' : 'x86';
|
const arch = os.arch() === 'x64' ? 'x64' : 'x86';
|
||||||
url = `https://ci.appveyor.com/api/projects/waruqi/xmake/artifacts/xmake-installer.exe?branch=${ver}&pr=false&job=Image%3A+Visual+Studio+2017%3B+Platform%3A+${arch}`;
|
return `https://ci.appveyor.com/api/projects/waruqi/xmake/artifacts/xmake-installer.exe?branch=${ver}&pr=false&job=Image%3A+Visual+Studio+2017%3B+Platform%3A+${arch}`;
|
||||||
}
|
}
|
||||||
else if (version.type === 'pull') {
|
else if (version.type === 'pull') {
|
||||||
throw new Error('PR builds for windows is not supported');
|
throw new Error('PR builds for windows is not supported');
|
||||||
@@ -24,10 +20,17 @@ async function winInstall(version) {
|
|||||||
else {
|
else {
|
||||||
// we cannot use appveyor ci artifacts, the old version links may be broken.
|
// we cannot use appveyor ci artifacts, the old version links may be broken.
|
||||||
const arch = os.arch() === 'x64' ? 'win64' : 'win32';
|
const arch = os.arch() === 'x64' ? 'win64' : 'win32';
|
||||||
url = semver.gt(ver, '2.2.6')
|
return semver.gt(ver, '2.2.6')
|
||||||
? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe`
|
? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe`
|
||||||
: `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.exe`;
|
: `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.exe`;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
async function winInstall(version) {
|
||||||
|
const ver = version.version;
|
||||||
|
let toolDir = toolCache.find('xmake', ver);
|
||||||
|
if (!toolDir) {
|
||||||
|
const installer = await core.group(`download xmake ${version}`, async () => {
|
||||||
|
const url = getInstallerUrl(version);
|
||||||
core.info(`downloading from ${url}`);
|
core.info(`downloading from ${url}`);
|
||||||
const file = await toolCache.downloadTool(url);
|
const file = await toolCache.downloadTool(url);
|
||||||
const exe = path.format({ ...path.parse(file), ext: '.exe', base: undefined });
|
const exe = path.format({ ...path.parse(file), ext: '.exe', base: undefined });
|
||||||
|
|||||||
+14
-1
@@ -8,9 +8,22 @@ function makeOpt(ref: string): { cwd: string } {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type RefDic = {
|
export type RefDic = {
|
||||||
|
/** branches */
|
||||||
heads: Record<string, string>;
|
heads: Record<string, string>;
|
||||||
|
/** tags */
|
||||||
tags: Record<string, string>;
|
tags: Record<string, string>;
|
||||||
pull: Record<number, { head?: string; merge?: string }>;
|
/** pull requests */
|
||||||
|
pull: Record<
|
||||||
|
number,
|
||||||
|
{
|
||||||
|
/** the current state of the pull request */
|
||||||
|
head: string;
|
||||||
|
/** the current branch we're merging onto */
|
||||||
|
base?: string;
|
||||||
|
/** merge result */
|
||||||
|
merge?: string;
|
||||||
|
}
|
||||||
|
>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function lsRemote(): Promise<RefDic> {
|
export async function lsRemote(): Promise<RefDic> {
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ async function selectPr(pr: number): Promise<Version> {
|
|||||||
const versions = await lsRemote();
|
const versions = await lsRemote();
|
||||||
if (pr in versions.pull) {
|
if (pr in versions.pull) {
|
||||||
const prheads = versions.pull[pr];
|
const prheads = versions.pull[pr];
|
||||||
const sha = prheads.merge ?? prheads.head;
|
const sha = prheads.head;
|
||||||
if (sha) {
|
if (sha) {
|
||||||
return new VersionImpl(`#${pr}`, sha, 'pull', `pull request #${pr}`);
|
return new VersionImpl(`#${pr}`, sha, 'pull', `pull request #${pr}`);
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-7
@@ -7,25 +7,29 @@ import * as path from 'path';
|
|||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
import { Version } from './versions';
|
import { Version } from './versions';
|
||||||
|
|
||||||
export async function winInstall(version: Version): Promise<void> {
|
function getInstallerUrl(version: Version): string {
|
||||||
const ver = version.version;
|
const ver = version.version;
|
||||||
let toolDir = toolCache.find('xmake', ver);
|
|
||||||
if (!toolDir) {
|
|
||||||
const installer = await core.group(`download xmake ${version}`, async () => {
|
|
||||||
let url = '';
|
|
||||||
if (version.type === 'heads') {
|
if (version.type === 'heads') {
|
||||||
// we only use appveyor ci artifacts for branch version
|
// we only use appveyor ci artifacts for branch version
|
||||||
const arch = os.arch() === 'x64' ? 'x64' : 'x86';
|
const arch = os.arch() === 'x64' ? 'x64' : 'x86';
|
||||||
url = `https://ci.appveyor.com/api/projects/waruqi/xmake/artifacts/xmake-installer.exe?branch=${ver}&pr=false&job=Image%3A+Visual+Studio+2017%3B+Platform%3A+${arch}`;
|
return `https://ci.appveyor.com/api/projects/waruqi/xmake/artifacts/xmake-installer.exe?branch=${ver}&pr=false&job=Image%3A+Visual+Studio+2017%3B+Platform%3A+${arch}`;
|
||||||
} else if (version.type === 'pull') {
|
} else if (version.type === 'pull') {
|
||||||
throw new Error('PR builds for windows is not supported');
|
throw new Error('PR builds for windows is not supported');
|
||||||
} else {
|
} else {
|
||||||
// we cannot use appveyor ci artifacts, the old version links may be broken.
|
// we cannot use appveyor ci artifacts, the old version links may be broken.
|
||||||
const arch = os.arch() === 'x64' ? 'win64' : 'win32';
|
const arch = os.arch() === 'x64' ? 'win64' : 'win32';
|
||||||
url = semver.gt(ver, '2.2.6')
|
return semver.gt(ver, '2.2.6')
|
||||||
? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe`
|
? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe`
|
||||||
: `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.exe`;
|
: `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.exe`;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function winInstall(version: Version): Promise<void> {
|
||||||
|
const ver = version.version;
|
||||||
|
let toolDir = toolCache.find('xmake', ver);
|
||||||
|
if (!toolDir) {
|
||||||
|
const installer = await core.group(`download xmake ${version}`, async () => {
|
||||||
|
const url = getInstallerUrl(version);
|
||||||
core.info(`downloading from ${url}`);
|
core.info(`downloading from ${url}`);
|
||||||
const file = await toolCache.downloadTool(url);
|
const file = await toolCache.downloadTool(url);
|
||||||
const exe = path.format({ ...path.parse(file), ext: '.exe', base: undefined });
|
const exe = path.format({ ...path.parse(file), ext: '.exe', base: undefined });
|
||||||
|
|||||||
Reference in New Issue
Block a user