Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

force date into a semver-compliant version #148

Merged
merged 1 commit into from
Jul 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@ function parseInput() {
}

async function downloadInstaller() {
const inst_path = tc.find('msys2-installer', inst_version, 'x64');
const version = `0.0.${inst_version.replace(/-/g, '')}`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the problem with the follwing?

const version = `${inst_version.replace(/-/g, '.')}`

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the last part only makes the version incompatible to all other versions according to semver.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I will add a comment about it!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea. (though I don't know if anything does any semver related version comparison here, but that's one advantage I could think of)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what I was thinking is that if msys2 ever wanted to use 'real' versions, version numbers up to 2021 (or even newer) would be considered 'older' than version 1.0.

I do think there is some semver comparison going on in the tool-cache too.

const inst_path = tc.find('msys2-installer', version, 'x64');
const destination = inst_path ? path.join(inst_path, 'base.exe') : await tc.downloadTool(inst_url);
let computedChecksum = '';
await exec.exec(`powershell.exe`, [`(Get-FileHash ${destination} -Algorithm SHA256)[0].Hash`], {listeners: {stdout: (data) => { computedChecksum += data.toString(); }}});
if (computedChecksum.slice(0, -2).toUpperCase() !== checksum.toUpperCase()) {
throw new Error(`The SHA256 of the installer does not match! expected ${checksum} got ${computedChecksum}`);
}
return path.join(inst_path || await tc.cacheFile(destination, 'base.exe', 'msys2-installer', inst_version, 'x64'), 'base.exe');
return path.join(inst_path || await tc.cacheFile(destination, 'base.exe', 'msys2-installer', version, 'x64'), 'base.exe');
}

async function disableKeyRefresh(msysRootDir) {
Expand Down