Skip to content

Commit 23b2b5e

Browse files
committed
Create the .complete file so tc.find() can find it for future runs for self-hosted runners
1 parent 42fc2d3 commit 23b2b5e

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

common.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ export function getToolCacheRubyPrefix(platform, version) {
9999
return path.join(toolCache, 'Ruby', version, 'x64')
100100
}
101101

102+
export function createToolCacheCompleteFile(toolCacheRubyPrefix) {
103+
const completeFile = `${toolCacheRubyPrefix}.complete`
104+
fs.writeFileSync(completeFile, '')
105+
}
106+
102107
// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
103108
export function win2nix(path) {
104109
if (/^[A-Z]:/i.test(path)) {

dist/index.js

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

ruby-builder.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) {
6060
await exec.exec('tar', ['-xz', '-C', parentDir, '-f', downloadPath])
6161
}
6262
})
63+
64+
if (common.shouldUseToolCache(engine, version)) {
65+
common.createToolCacheCompleteFile(rubyPrefix)
66+
}
6367
}
6468

6569
function getDownloadURL(platform, engine, version) {

windows.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ export async function install(platform, engine, version) {
5353
common.setupPath([`${rubyPrefix}\\bin`, ...toolchainPaths])
5454

5555
if (!inToolCache) {
56-
await downloadAndExtract(url, base, rubyPrefix);
56+
await downloadAndExtract(engine, version, url, base, rubyPrefix);
5757
}
5858

5959
return rubyPrefix
6060
}
6161

62-
async function downloadAndExtract(url, base, rubyPrefix) {
62+
async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
6363
const parentDir = path.dirname(rubyPrefix)
6464

6565
const downloadPath = await common.measure('Downloading Ruby', async () => {
@@ -73,6 +73,10 @@ async function downloadAndExtract(url, base, rubyPrefix) {
7373
if (base !== path.basename(rubyPrefix)) {
7474
await io.mv(path.join(parentDir, base), rubyPrefix)
7575
}
76+
77+
if (common.shouldUseToolCache(engine, version)) {
78+
common.createToolCacheCompleteFile(rubyPrefix)
79+
}
7680
}
7781

7882
async function setupMingw(version) {

0 commit comments

Comments
 (0)