7 Commits

Author SHA1 Message Date
c308fdd69d Merge pull request #31 from crazy-max/fix-setoutput
Fix setOutput behavior
2021-04-23 23:28:09 +02:00
1e2879cd72 Fix setOutput behavior
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-04-23 23:25:00 +02:00
a803c66e06 Merge pull request #30 from crazy-max/remove-limitation
Remove os limitation
2021-04-23 14:09:46 -07:00
a0030908e9 Remove os limitation
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-04-16 16:29:10 +02:00
caa853cef4 Merge pull request #29 from docker/dependabot/npm_and_yarn/actions/core-1.2.7
Bump @actions/core from 1.2.6 to 1.2.7
2021-04-15 18:04:44 +02:00
ca76aa0f9a Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-04-15 18:00:26 +02:00
0fb740971a Bump @actions/core from 1.2.6 to 1.2.7
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.6 to 1.2.7.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-14 04:08:47 +00:00
6 changed files with 55 additions and 22 deletions

View File

@ -43,3 +43,31 @@ jobs:
- -
name: Dump context name: Dump context
uses: crazy-max/ghaction-dump-context@v1 uses: crazy-max/ghaction-dump-context@v1
error:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Stop docker
run: |
sudo systemctl stop docker
-
name: Set up QEMU
id: qemu
continue-on-error: true
uses: ./
-
name: Check
run: |
echo "${{ toJson(steps.qemu) }}"
if [ "${{ steps.qemu.outcome }}" != "failure" ] || [ "${{ steps.qemu.conclusion }}" != "success" ]; then
echo "::error::Should have failed"
exit 1
fi
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v1

View File

@ -19,7 +19,6 @@ ___
* [Customizing](#customizing) * [Customizing](#customizing)
* [inputs](#inputs) * [inputs](#inputs)
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot) * [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
* [Limitation](#limitation)
## Usage ## Usage
@ -82,7 +81,3 @@ updates:
schedule: schedule:
interval: "daily" interval: "daily"
``` ```
## Limitation
This action is only available for Linux [virtual environments](https://docs.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners#supported-virtual-environments-and-hardware-resources).

17
dist/index.js generated vendored
View File

@ -90,17 +90,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const os = __importStar(__webpack_require__(87));
const mexec = __importStar(__webpack_require__(757)); const mexec = __importStar(__webpack_require__(757));
const core = __importStar(__webpack_require__(186)); const core = __importStar(__webpack_require__(186));
const exec = __importStar(__webpack_require__(514)); const exec = __importStar(__webpack_require__(514));
const command_1 = __webpack_require__(241);
function run() { function run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
if (os.platform() !== 'linux') { core.startGroup(`Docker info`);
core.setFailed('Only supported on linux platform'); yield exec.exec('docker', ['version']);
return; yield exec.exec('docker', ['info']);
} core.endGroup();
const image = core.getInput('image') || 'tonistiigi/binfmt:latest'; const image = core.getInput('image') || 'tonistiigi/binfmt:latest';
const platforms = core.getInput('platforms') || 'all'; const platforms = core.getInput('platforms') || 'all';
core.startGroup(`Pulling binfmt Docker image`); core.startGroup(`Pulling binfmt Docker image`);
@ -116,7 +116,7 @@ function run() {
} }
const platforms = JSON.parse(res.stdout.trim()); const platforms = JSON.parse(res.stdout.trim());
core.info(`${platforms.supported.join(',')}`); core.info(`${platforms.supported.join(',')}`);
core.setOutput('platforms', platforms.supported.join(',')); setOutput('platforms', platforms.supported.join(','));
}); });
core.endGroup(); core.endGroup();
} }
@ -125,6 +125,10 @@ function run() {
} }
}); });
} }
// FIXME: Temp fix https://github.com/actions/toolkit/issues/777
function setOutput(name, value) {
command_1.issueCommand('set-output', { name }, value);
}
run(); run();
//# sourceMappingURL=main.js.map //# sourceMappingURL=main.js.map
@ -854,6 +858,7 @@ exports.getInput = getInput;
*/ */
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
function setOutput(name, value) { function setOutput(name, value) {
process.stdout.write(os.EOL);
command_1.issueCommand('set-output', { name }, value); command_1.issueCommand('set-output', { name }, value);
} }
exports.setOutput = setOutput; exports.setOutput = setOutput;

View File

@ -26,7 +26,7 @@
], ],
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@actions/core": "^1.2.6", "@actions/core": "^1.2.7",
"@actions/exec": "^1.0.4" "@actions/exec": "^1.0.4"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,7 +1,7 @@
import * as os from 'os';
import * as mexec from './exec'; import * as mexec from './exec';
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as exec from '@actions/exec'; import * as exec from '@actions/exec';
import {issueCommand} from '@actions/core/lib/command';
interface Platforms { interface Platforms {
supported: string[]; supported: string[];
@ -10,10 +10,10 @@ interface Platforms {
async function run(): Promise<void> { async function run(): Promise<void> {
try { try {
if (os.platform() !== 'linux') { core.startGroup(`Docker info`);
core.setFailed('Only supported on linux platform'); await exec.exec('docker', ['version']);
return; await exec.exec('docker', ['info']);
} core.endGroup();
const image: string = core.getInput('image') || 'tonistiigi/binfmt:latest'; const image: string = core.getInput('image') || 'tonistiigi/binfmt:latest';
const platforms: string = core.getInput('platforms') || 'all'; const platforms: string = core.getInput('platforms') || 'all';
@ -33,7 +33,7 @@ async function run(): Promise<void> {
} }
const platforms: Platforms = JSON.parse(res.stdout.trim()); const platforms: Platforms = JSON.parse(res.stdout.trim());
core.info(`${platforms.supported.join(',')}`); core.info(`${platforms.supported.join(',')}`);
core.setOutput('platforms', platforms.supported.join(',')); setOutput('platforms', platforms.supported.join(','));
}); });
core.endGroup(); core.endGroup();
} catch (error) { } catch (error) {
@ -41,4 +41,9 @@ async function run(): Promise<void> {
} }
} }
// FIXME: Temp fix https://github.com/actions/toolkit/issues/777
function setOutput(name: string, value: any): void {
issueCommand('set-output', {name}, value);
}
run(); run();

View File

@ -2,10 +2,10 @@
# yarn lockfile v1 # yarn lockfile v1
"@actions/core@^1.2.6": "@actions/core@^1.2.7":
version "1.2.6" version "1.2.7"
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.6.tgz#a78d49f41a4def18e88ce47c2cac615d5694bf09" resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.7.tgz#594f8c45b213f0146e4be7eda8ae5cf4e198e5ab"
integrity sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA== integrity sha512-kzLFD5BgEvq6ubcxdgPbRKGD2Qrgya/5j+wh4LZzqT915I0V3rED+MvjH6NXghbvk1MXknpNNQ3uKjXSEN00Ig==
"@actions/exec@^1.0.4": "@actions/exec@^1.0.4":
version "1.0.4" version "1.0.4"