Skip to content

Commit

Permalink
Remove os limitation
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Apr 27, 2021
1 parent 52facdd commit 6608fa7
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 23 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -56,3 +56,33 @@ jobs:
name: Dump context
if: always()
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: Build
id: bake
uses: ./
with:
files: |
./test/config.hcl
-
name: Check
run: |
echo "${{ toJson(steps.bake) }}"
if [ "${{ steps.bake.outcome }}" != "failure" ] || [ "${{ steps.bake.conclusion }}" != "success" ]; then
echo "::error::Should have failed"
exit 1
fi
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v1
5 changes: 0 additions & 5 deletions README.md
Expand Up @@ -20,7 +20,6 @@ ___
* [Customizing](#customizing)
* [inputs](#inputs)
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
* [Limitation](#limitation)

## Usage

Expand Down Expand Up @@ -102,7 +101,3 @@ updates:
schedule:
interval: "daily"
```
## Limitation
This action is only available for Linux [virtual environments](https://help.github.com/en/articles/virtual-environments-for-github-actions#supported-virtual-environments-and-hardware-resources).
17 changes: 8 additions & 9 deletions dist/index.js

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

17 changes: 8 additions & 9 deletions src/main.ts
@@ -1,32 +1,31 @@
import * as os from 'os';
import * as buildx from './buildx';
import * as context from './context';
import * as core from '@actions/core';
import * as exec from '@actions/exec';

async function run(): Promise<void> {
try {
if (os.platform() !== 'linux') {
core.setFailed('Only supported on linux platform');
return;
}
core.startGroup(`Docker info`);
await exec.exec('docker', ['version']);
await exec.exec('docker', ['info']);
core.endGroup();

if (!(await buildx.isAvailable())) {
core.setFailed(`Buildx is required. See https://github.com/docker/setup-buildx-action to set up buildx.`);
core.setFailed(`Docker buildx is required. See https://github.com/docker/setup-buildx-action to set up buildx.`);
return;
}

const buildxVersion = await buildx.getVersion();
core.info(`📣 Buildx version: ${buildxVersion}`);
core.info(`Using buildx ${buildxVersion}`);

let inputs: context.Inputs = await context.getInputs();
const args: string[] = await context.getArgs(inputs, buildxVersion);

core.startGroup(`💡 Bake definition`);
core.startGroup(`Bake definition`);
await exec.exec('docker', [...args, '--print']);
core.endGroup();

core.info(`🏃 Building...`);
core.info(`Building...`);
await exec.exec('docker', args);
} catch (error) {
core.setFailed(error.message);
Expand Down

0 comments on commit 6608fa7

Please sign in to comment.