Skip to content

Commit 85252d8

Browse files
committed
docker(install): fix source archive version
Signed-off-by: CrazyMax <[email protected]>
1 parent 7390474 commit 85252d8

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

__tests__/docker/install.test.itg.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ function getSources(root: boolean): Array<InstallSource> {
173173
{type: 'image', tag: 'master'} as InstallSourceImage,
174174
{type: 'image', tag: 'latest'} as InstallSourceImage,
175175
{type: 'archive', version: 'v26.1.4', channel: 'stable'} as InstallSourceArchive,
176-
{type: 'archive', version: 'latest', channel: 'stable'} as InstallSourceArchive
176+
{type: 'archive', version: 'latest', channel: 'stable'} as InstallSourceArchive,
177+
{type: 'archive', version: 'v29.0.0-rc.1', channel: 'test'} as InstallSourceArchive
177178
];
178179
} else {
179180
// prettier-ignore

__tests__/docker/install.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ describe('download', () => {
5353
[archive('v20.10.22', 'stable'), 'linux'],
5454
[archive('v20.10.22', 'stable'), 'darwin'],
5555
[archive('v20.10.22', 'stable'), 'win32'],
56+
[archive('v29.0.0-rc.1', 'test'), 'linux'],
5657

5758
[image('master'), 'linux'],
5859
[image('master'), 'win32'],
@@ -89,6 +90,14 @@ describe('getRelease', () => {
8990
expect(release?.html_url).toEqual('https://github.com/moby/moby/releases/tag/v23.0.0');
9091
});
9192

93+
it('returns v29.0.0-rc.1 buildx GitHub release', async () => {
94+
const release = await Install.getRelease('v29.0.0-rc.1');
95+
expect(release).not.toBeNull();
96+
expect(release?.id).toEqual(252020476);
97+
expect(release?.tag_name).toEqual('docker-v29.0.0-rc.1');
98+
expect(release?.html_url).toEqual('https://github.com/moby/moby/releases/tag/docker-v29.0.0-rc.1');
99+
});
100+
92101
it('unknown release', async () => {
93102
await expect(Install.getRelease('foo')).rejects.toThrow(new Error('Cannot find Docker release foo in https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/docker-releases.json'));
94103
});

src/docker/install.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export class Install {
204204

205205
private async downloadSourceArchive(component: 'docker' | 'docker-rootless-extras', src: InstallSourceArchive): Promise<string> {
206206
const release: GitHubRelease = await Install.getRelease(src.version);
207-
this._version = release.tag_name.replace(/^v+|v+$/g, '');
207+
this._version = release.tag_name.replace(/^(docker-)?v+/, '');
208208
core.debug(`docker.Install.downloadSourceArchive version: ${this._version}`);
209209

210210
const downloadURL = this.downloadURL(component, this._version, src.channel);

0 commit comments

Comments
 (0)