Skip to content

Commit

Permalink
Support the --build-platform arg
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobwgillespie committed May 1, 2023
1 parent 64ae436 commit b07380c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ This action needs a Depot API token to communicate with your project's builders.

### Depot-specific inputs

| Name | Type | Description |
| --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `project` | String | Depot [project](https://depot.dev/docs/core-concepts#projects) ID to route the image build to your projects builders (default: the `depot.json` file at the root of your repo) |
| `token` | String | You must authenticate with the Depot API to communicate with your projects builders ([see Authentication above](#authentication)) |
| Name | Type | Description |
| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `project` | String | Depot [project](https://depot.dev/docs/core-concepts#projects) ID to route the image build to your projects builders (default: the `depot.json` file at the root of your repo) |
| `token` | String | You must authenticate with the Depot API to communicate with your projects builders ([see Authentication above](#authentication)) |
| `build-platform` | String | The platform to use for the build ( `linux/amd64` or `linux/arm64`) |

### General inputs

Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ runs:
main: dist/index.js
post: dist/index.js
inputs:
build-platform:
description: 'The platform to use for the build'
required: false
buildx-fallback:
description: 'Fallback to `docker buildx bake` if `depot bake` fails'
required: false
Expand Down
20 changes: 10 additions & 10 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface Inputs {
project: string
token?: string
buildxFallback: boolean
buildPlatform?: string
}

export function getInputs(): Inputs {
Expand All @@ -38,6 +39,7 @@ export function getInputs(): Inputs {
project: core.getInput('project'),
token: core.getInput('token') || process.env.DEPOT_TOKEN,
buildxFallback: core.getBooleanInput('buildx-fallback'),
buildPlatform: core.getInput('build-platform'),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/depot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export async function bake(inputs: Inputs) {
}
}

const depotArgs = [...flag('--project', inputs.project)]
const depotArgs = [...flag('--project', inputs.project), ...flag('--build-platform', inputs.buildPlatform)]
const args = [...bakeArgs, ...depotArgs, ...targets]

// Attempt to exchange GitHub Actions OIDC token for temporary Depot trust relationship token
Expand Down

0 comments on commit b07380c

Please sign in to comment.