Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
25 changes: 21 additions & 4 deletions dist/get-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/get-plan/index.js.map

Large diffs are not rendered by default.

66 changes: 36 additions & 30 deletions dist/publish/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/publish/index.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

Each revision is versioned by the date of the revision.

## 2026-03-09

- Publish charm workflow supports uploading multiple charm artifacts.

## 2026-03-04

- Cache rock build results for register-typed rocks.
Expand Down
24 changes: 20 additions & 4 deletions src/get-plan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export class GetPlan {
}
return 0
})
let mergedPlan: Plan | undefined
for (const artifact of artifacts) {
const tmp = mkdtemp()
await this.artifact.downloadArtifact(artifact.id, {
Expand All @@ -121,18 +122,33 @@ export class GetPlan {
const plan = JSON.parse(
fs.readFileSync(path.join(tmp, 'plan.json'), { encoding: 'utf-8' })
) as Plan
if (
const matches =
plan.working_directory === '.' ||
normalizePath(this.workingDir) ===
normalizePath(plan.working_directory) ||
normalizePath(this.workingDir).startsWith(
normalizePath(plan.working_directory) + '/'
)
) {
return plan
if (!matches) {
continue
}
if (!mergedPlan) {
mergedPlan = plan
continue
}
// Merge charm build entries from additional matching plans
// (e.g. different architecture invocations of the same integration test)
const existingOutputs = new Set(mergedPlan.build.map(b => b.output))
for (const build of plan.build) {
if (build.type === 'charm' && !existingOutputs.has(build.output)) {
mergedPlan.build.push(build)
}
}
}
if (!mergedPlan) {
throw new Error(`can't find plan artifact for workflow run ${runId}`)
}
throw new Error(`can't find plan artifact for workflow run ${runId}`)
return mergedPlan
}

async run() {
Expand Down
68 changes: 36 additions & 32 deletions src/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,49 +263,53 @@ class Publish {
if (charms.length === 0) {
throw new Error('no charm to upload')
}
if (charms.length > 1) {
throw new Error(
`more than one charm to upload: ${charms.map(c => c.name)}`
let charmName: string | undefined
let charmSourceDir: string | undefined
const allFiles: string[] = []
for (const charm of charms) {
const tmp = mkdtemp()
core.info(
`download charm artifact "${charm.output}" from integration workflow (run id: ${runId})`
)
}
const charm = charms[0]
const tmp = mkdtemp()
core.info(
`download charm artifact from integration workflow (run id: ${runId})`
)
const artifact = (
await this.artifact.getArtifact(charm.output, {
const artifact = (
await this.artifact.getArtifact(charm.output, {
findBy: {
token: this.token,
repositoryOwner: github.context.repo.owner,
repositoryName: github.context.repo.repo,
workflowRunId: runId
}
})
).artifact
await this.artifact.downloadArtifact(artifact.id, {
path: tmp,
findBy: {
token: this.token,
repositoryOwner: github.context.repo.owner,
repositoryName: github.context.repo.repo,
workflowRunId: runId
}
})
).artifact
await this.artifact.downloadArtifact(artifact.id, {
path: tmp,
findBy: {
token: this.token,
repositoryOwner: github.context.repo.owner,
repositoryName: github.context.repo.repo,
workflowRunId: runId
}
})
const manifest = parseManifest(
JSON.parse(
fs.readFileSync(path.join(tmp, 'manifest.json'), {
encoding: 'utf-8'
})
const manifest = parseManifest(
JSON.parse(
fs.readFileSync(path.join(tmp, 'manifest.json'), {
encoding: 'utf-8'
})
)
)
)
if (!manifest.files) {
throw new Error(`charm ${charm.name} missing files in manifest`)
if (!manifest.files) {
throw new Error(`charm ${charm.name} missing files in manifest`)
}
if (!charmName) {
charmName = manifest.name
charmSourceDir = charm.source_directory
}
Comment thread
yanksyoon marked this conversation as resolved.
allFiles.push(...manifest.files.map(f => path.join(tmp, f)))
}
return {
name: manifest.name,
dir: charm.source_directory,
files: manifest.files.map(f => path.join(tmp, f))
name: charmName!,
dir: charmSourceDir!,
files: allFiles
}
}

Expand Down
Loading