Skip to content

Commit b126f6b

Browse files
waruqiOpportunityLiu
authored andcommitted
download dev from github releases
fix ci remove unused import fix releases
1 parent 2f05f7c commit b126f6b

File tree

6 files changed

+30
-22
lines changed

6 files changed

+30
-22
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
os: [ubuntu-latest, windows-latest, macOS-latest]
11-
version: [latest, branch@master]
11+
version: [latest, branch@master, branch@dev]
1212

1313
runs-on: ${{ matrix.os }}
1414

@@ -19,6 +19,7 @@ jobs:
1919
xmake-version: ${{ matrix.version }}
2020
- name: Run tests
2121
run: |
22+
xmake --version
2223
xmake create -P test
2324
xmake build -P test
2425
xmake run -P test

dist/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ const unix_install_1 = require("./unix-install");
99
async function run() {
1010
try {
1111
const version = await versions_1.selectVersion();
12-
if (os.platform() === 'win32' || os.platform() === 'cygwin')
13-
await win_install_1.winInstall(version);
14-
else
12+
if (os.platform() === 'win32' || os.platform() === 'cygwin') {
13+
const latest = await versions_1.selectVersion('latest');
14+
await win_install_1.winInstall(version, latest);
15+
}
16+
else {
1517
await unix_install_1.unixInstall(version);
18+
}
1619
await exec_1.exec('xmake --version');
1720
}
1821
catch (error) {

dist/win-install.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ const toolCache = require("@actions/tool-cache");
88
const os = require("os");
99
const path = require("path");
1010
const semver = require("semver");
11-
function getInstallerUrl(version) {
11+
function getInstallerUrl(version, latest) {
1212
const ver = version.version;
1313
switch (version.type) {
1414
case 'heads': {
15-
const arch = os.arch() === 'x64' ? 'x64' : 'x86';
16-
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}`;
15+
const arch = os.arch() === 'x64' ? 'win64' : 'win32';
16+
const latestver = latest.version;
17+
return `https://github.com/xmake-io/xmake/releases/download/${latestver}/xmake-${ver}.${arch}.exe`;
1718
}
1819
case 'pull': {
1920
throw new Error('PR builds for windows is not supported');
@@ -33,15 +34,15 @@ function getInstallerUrl(version) {
3334
}
3435
}
3536
}
36-
async function winInstall(version) {
37-
if (version.type === 'local') {
37+
async function winInstall(version, latest) {
38+
if (version.type === 'local' || latest.type == 'local') {
3839
throw new Error('Local builds for windows is not supported');
3940
}
4041
const ver = version.version;
4142
let toolDir = toolCache.find('xmake', ver);
4243
if (!toolDir) {
4344
const installer = await core.group(`download xmake ${String(version)}`, async () => {
44-
const url = getInstallerUrl(version);
45+
const url = getInstallerUrl(version, latest);
4546
core.info(`downloading from ${url}`);
4647
const file = await toolCache.downloadTool(url);
4748
const exe = path.format({

node_modules/.yarn-integrity

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ import { unixInstall } from './unix-install';
88
async function run(): Promise<void> {
99
try {
1010
const version = await selectVersion();
11-
if (os.platform() === 'win32' || os.platform() === 'cygwin') await winInstall(version);
12-
else await unixInstall(version);
11+
if (os.platform() === 'win32' || os.platform() === 'cygwin') {
12+
const latest = await selectVersion('latest');
13+
await winInstall(version, latest);
14+
} else {
15+
await unixInstall(version);
16+
}
1317
await exec('xmake --version');
1418
} catch (error) {
1519
const ex = error as Error;

src/win-install.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import * as path from 'path';
77
import * as semver from 'semver';
88
import { Version, GitVersion } from './interfaces';
99

10-
function getInstallerUrl(version: GitVersion): string {
10+
function getInstallerUrl(version: GitVersion, latest: GitVersion): string {
1111
const ver = version.version;
1212
switch (version.type) {
1313
case 'heads': {
14-
// we only use appveyor ci artifacts for branch version
15-
const arch = os.arch() === 'x64' ? 'x64' : 'x86';
16-
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}`;
14+
const arch = os.arch() === 'x64' ? 'win64' : 'win32';
15+
const latestver = latest.version;
16+
return `https://github.com/xmake-io/xmake/releases/download/${latestver}/xmake-${ver}.${arch}.exe`;
1717
}
1818
case 'pull': {
1919
throw new Error('PR builds for windows is not supported');
@@ -22,7 +22,6 @@ function getInstallerUrl(version: GitVersion): string {
2222
throw new Error('Sha builds for windows is not supported');
2323
}
2424
case 'tags': {
25-
// we cannot use appveyor ci artifacts, the old version links may be broken.
2625
const arch = os.arch() === 'x64' ? 'win64' : 'win32';
2726
return semver.gt(ver, '2.2.6')
2827
? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe`
@@ -36,15 +35,15 @@ function getInstallerUrl(version: GitVersion): string {
3635
}
3736
}
3837

39-
export async function winInstall(version: Version): Promise<void> {
40-
if (version.type === 'local') {
38+
export async function winInstall(version: Version, latest: Version): Promise<void> {
39+
if (version.type === 'local' || latest.type == 'local') {
4140
throw new Error('Local builds for windows is not supported');
4241
}
4342
const ver = version.version;
4443
let toolDir = toolCache.find('xmake', ver);
4544
if (!toolDir) {
4645
const installer = await core.group(`download xmake ${String(version)}`, async () => {
47-
const url = getInstallerUrl(version);
46+
const url = getInstallerUrl(version, latest);
4847
core.info(`downloading from ${url}`);
4948
const file = await toolCache.downloadTool(url);
5049
const exe = path.format({

0 commit comments

Comments
 (0)