Skip to content

Commit

Permalink
Uninstall current emulators
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Feb 13, 2021
1 parent 70e4374 commit 9aeaa42
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
12 changes: 10 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions src/main.ts
Expand Up @@ -18,10 +18,19 @@ async function run(): Promise<void> {
const image: string = core.getInput('image') || 'tonistiigi/binfmt:latest';
const platforms: string = core.getInput('platforms') || 'all';

core.info(`💎 Installing QEMU static binaries...`);
core.startGroup(`Downloading binfmt Docker image`);
await exec.exec('docker', ['pull', image]);
core.endGroup();

core.startGroup(`Uninstalling current emulators`);
await exec.exec('docker', ['run', '--rm', '--privileged', image, '--uninstall', 'qemu-']);
core.endGroup();

core.startGroup(`Installing QEMU static binaries`);
await exec.exec('docker', ['run', '--rm', '--privileged', image, '--install', platforms]);
core.endGroup();

core.info('🛒 Extracting available platforms...');
core.startGroup(`Extracting available platforms`);
await mexec.exec(`docker`, ['run', '--rm', '--privileged', image], true).then(res => {
if (res.stderr != '' && !res.success) {
throw new Error(res.stderr);
Expand All @@ -30,6 +39,7 @@ async function run(): Promise<void> {
core.info(`${platforms.supported.join(',')}`);
core.setOutput('platforms', platforms.supported.join(','));
});
core.endGroup();
} catch (error) {
core.setFailed(error.message);
}
Expand Down

0 comments on commit 9aeaa42

Please sign in to comment.