Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Commit dc6d1b9

Browse files
authored
Merge pull request #10 from codehz/master
Include option to provide build arguments.
2 parents 645c5ae + e6e4256 commit dc6d1b9

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ inputs:
2020
imageTag:
2121
description: "The desired tag for the image. Defaults to current branch or release version number."
2222
required: false
23+
buildArguments:
24+
description: "The build arguments for image."
25+
required: false
2326
outputs:
2427
imageURL:
2528
description: "The URL of the image."

index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,18 @@ async function run() {
5959
const refArray = ref.split('/');
6060
if (!imageTag) imageTag = refArray[refArray.length - 1];
6161

62+
// Process the build args
63+
let buildArg = [];
64+
const buildArgsRaw = core.getInput('buildArg', { require: false });
65+
if (buildArgsRaw) buildArg = buildArgsRaw.match(/(\\.|[^&])+/g).flatMap(str => ["--build-arg", str]);
66+
6267
// Set some variables.
6368
const imageURL = `docker.pkg.github.com/${repository}/${imageName}:${imageTag}`
6469

6570
// Build the Docker image.
6671
await exec.exec(
6772
`docker`,
68-
['build', '--tag', imageURL, workspace]);
73+
['build', '--tag', imageURL, workspace, ...buildArg]);
6974

7075
// Push the Docker image.
7176
await exec.exec(

0 commit comments

Comments
 (0)