fix: version prefix 'v' is missing for docker-compose v2
* System naming for docker-compose >= 2.0 fixed As you might notice they started naming releases using not capitalized system name starting from `docker-compose` v2.0.0 ([ref](https://github.com/docker/compose/releases/tag/v2.0.0)). This commit adds version check and fixes system name (returned by `uname -s`). * Update src/install.ts Co-authored-by: Kengo TODA <skypencil+github@gmail.com> * Version Naming for later versions updated * Parsing instead of lexicographical order applied * Update src/install.ts Co-authored-by: Kengo TODA <skypencil+github@gmail.com> * Tests for new release naming added * Integration test for versions > 2.0.0 added * Version tag for releases >= 2.0.0 fixed * Indentation restored * js files compiled * auto-appending 'v' added Co-authored-by: Kengo TODA <skypencil+github@gmail.com>
This commit is contained in:
committed by
GitHub
parent
861c11a3c2
commit
e1d8c7b2f9
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
@@ -34,3 +34,6 @@ jobs:
|
|||||||
- uses: ./
|
- uses: ./
|
||||||
with:
|
with:
|
||||||
version: '1.26.2'
|
version: '1.26.2'
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
version: '2.4.1'
|
||||||
|
|||||||
@@ -18,4 +18,5 @@ async function testVersion(version: string) {
|
|||||||
test('Install the right version', async () => {
|
test('Install the right version', async () => {
|
||||||
await testVersion('1.29.1')
|
await testVersion('1.29.1')
|
||||||
await testVersion('1.29.2')
|
await testVersion('1.29.2')
|
||||||
|
await testVersion('2.2.3')
|
||||||
})
|
})
|
||||||
|
|||||||
3
dist/index.js
vendored
3
dist/index.js
vendored
@@ -28,6 +28,9 @@ exports.runCommand = runCommand;
|
|||||||
async function installOnLinux(version) {
|
async function installOnLinux(version) {
|
||||||
const system = runCommand('uname -s');
|
const system = runCommand('uname -s');
|
||||||
const hardware = runCommand('uname -m');
|
const hardware = runCommand('uname -m');
|
||||||
|
if (!version.startsWith('v') && parseInt(version.split('.')[0], 10) >= 2) {
|
||||||
|
version = `v${version}`;
|
||||||
|
}
|
||||||
const url = `https://github.com/docker/compose/releases/download/${version}/docker-compose-${await system}-${await hardware}`;
|
const url = `https://github.com/docker/compose/releases/download/${version}/docker-compose-${await system}-${await hardware}`;
|
||||||
const installerPath = await (0, tool_cache_1.downloadTool)(url);
|
const installerPath = await (0, tool_cache_1.downloadTool)(url);
|
||||||
await (0, exec_1.exec)(`chmod +x ${installerPath}`);
|
await (0, exec_1.exec)(`chmod +x ${installerPath}`);
|
||||||
|
|||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/sourcemap-register.js
vendored
2
dist/sourcemap-register.js
vendored
File diff suppressed because one or more lines are too long
@@ -19,6 +19,9 @@ export async function runCommand(command: string): Promise<string> {
|
|||||||
async function installOnLinux(version: string): Promise<string> {
|
async function installOnLinux(version: string): Promise<string> {
|
||||||
const system = runCommand('uname -s')
|
const system = runCommand('uname -s')
|
||||||
const hardware = runCommand('uname -m')
|
const hardware = runCommand('uname -m')
|
||||||
|
if (!version.startsWith('v') && parseInt(version.split('.')[0], 10) >= 2) {
|
||||||
|
version = `v${version}`
|
||||||
|
}
|
||||||
const url = `https://github.com/docker/compose/releases/download/${version}/docker-compose-${await system}-${await hardware}`
|
const url = `https://github.com/docker/compose/releases/download/${version}/docker-compose-${await system}-${await hardware}`
|
||||||
const installerPath = await downloadTool(url)
|
const installerPath = await downloadTool(url)
|
||||||
await exec(`chmod +x ${installerPath}`)
|
await exec(`chmod +x ${installerPath}`)
|
||||||
|
|||||||
Reference in New Issue
Block a user