Embed the used tag in this repo for atomic updates

* Avoids stale cached requests for the latest_release.tag file.
* This also ensures reproducible builds for this repository.
This commit is contained in:
Benoit Daloze
2020-01-18 16:36:05 +01:00
parent 026be4409b
commit 7005fbe92a
2 changed files with 4 additions and 14 deletions
Generated Vendored
+2 -7
View File
@@ -1387,6 +1387,7 @@ const tc = __webpack_require__(533)
const axios = __webpack_require__(53)
const windows = __webpack_require__(664)
const builderReleaseTag = 'builds-bundler1'
const releasesURL = 'https://github.com/eregon/ruby-install-builder/releases'
const metadataURL = 'https://raw.githubusercontent.com/eregon/ruby-install-builder/metadata'
@@ -1416,8 +1417,7 @@ async function downloadAndExtract(platform, ruby) {
const rubiesDir = `${process.env.HOME}/.rubies`
await io.mkdirP(rubiesDir)
const tag = await getLatestReleaseTag()
const url = `${releasesURL}/download/${tag}/${ruby}-${platform}.tar.gz`
const url = `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz`
console.log(url)
const downloadPath = await tc.downloadTool(url)
@@ -1426,11 +1426,6 @@ async function downloadAndExtract(platform, ruby) {
return `${rubiesDir}/${ruby}`
}
async function getLatestReleaseTag() {
const response = await axios.get(`${metadataURL}/latest_release.tag`)
return response.data.trim()
}
async function getRubyEngineAndVersion(rubyVersion) {
if (rubyVersion === '.ruby-version') { // Read from .ruby-version
rubyVersion = fs.readFileSync('.ruby-version', 'utf8').trim()
+2 -7
View File
@@ -6,6 +6,7 @@ const tc = require('@actions/tool-cache')
const axios = require('axios')
const windows = require('./windows')
const builderReleaseTag = 'builds-bundler1'
const releasesURL = 'https://github.com/eregon/ruby-install-builder/releases'
const metadataURL = 'https://raw.githubusercontent.com/eregon/ruby-install-builder/metadata'
@@ -35,8 +36,7 @@ async function downloadAndExtract(platform, ruby) {
const rubiesDir = `${process.env.HOME}/.rubies`
await io.mkdirP(rubiesDir)
const tag = await getLatestReleaseTag()
const url = `${releasesURL}/download/${tag}/${ruby}-${platform}.tar.gz`
const url = `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz`
console.log(url)
const downloadPath = await tc.downloadTool(url)
@@ -45,11 +45,6 @@ async function downloadAndExtract(platform, ruby) {
return `${rubiesDir}/${ruby}`
}
async function getLatestReleaseTag() {
const response = await axios.get(`${metadataURL}/latest_release.tag`)
return response.data.trim()
}
async function getRubyEngineAndVersion(rubyVersion) {
if (rubyVersion === '.ruby-version') { // Read from .ruby-version
rubyVersion = fs.readFileSync('.ruby-version', 'utf8').trim()