Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions dist/build/index.js

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

2 changes: 1 addition & 1 deletion dist/build/index.js.map

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion dist/plan/index.js

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

2 changes: 1 addition & 1 deletion dist/plan/index.js.map

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,15 @@ interface BuildDockerImageParams {

async function buildFileResource(plan: BuildPlan): Promise<void> {
core.startGroup(`Build resource {plan.name}`)
await exec.exec(`./build-${plan.name}.sh`, [plan.source_file], {
if (!plan.build_target) {
throw new Error('build_target is required for file resources')
}
await exec.exec(`./${plan.source_file}`, [plan.build_target], {
cwd: plan.source_directory
})
core.endGroup()
const resourceFiles = await (
await glob.create(path.join(plan.source_directory, plan.source_file))
await glob.create(path.join(plan.source_directory, plan.build_target))
).glob()
const artifact = new DefaultArtifactClient()
const manifestFile = path.join(plan.source_directory, 'manifest.json')
Expand Down
1 change: 1 addition & 0 deletions src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface BuildPlan {
name: string
source_file: string
source_directory: string
build_target: string | undefined
output_type: 'file' | 'registry'
output: string
}
Expand Down
6 changes: 5 additions & 1 deletion src/plan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ async function planBuildCharm(
name,
source_file: file,
source_directory: path.dirname(file),
build_target: undefined,
output_type: 'file',
output: sanitizeArtifactName(`${id}__build__output__charm__${name}`)
}
Expand All @@ -97,6 +98,7 @@ async function planBuildRock(
name,
source_file: file,
source_directory: path.dirname(file),
build_target: undefined,
output_type: outputType,
output: sanitizeArtifactName(`${id}__build__output__rock__${name}`)
}
Expand All @@ -119,6 +121,7 @@ async function planBuildDockerImage(
name,
source_file: file,
source_directory: path.dirname(file),
build_target: undefined,
output_type: outputType,
output: sanitizeArtifactName(
`${id}__build__output__docker-image__${name}`
Expand Down Expand Up @@ -181,7 +184,8 @@ async function planBuildFileResource(
acc.push({
type: 'file',
name: resourceName,
source_file: resource.filename,
source_file: `build-${resourceName}.sh`,
build_target: resource.filename,
source_directory: parent,
output_type: 'file',
output: sanitizeArtifactName(
Expand Down
Loading