Skip to content

Commit 86ef0ff

Browse files
Added option for publishing sub-packages
1 parent e5c6c80 commit 86ef0ff

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

.github/workflows/tag-release.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ on:
1616
required: false
1717
default: "0.18.0"
1818
publish_package:
19-
description: "Whether to publish a package to an npm registry"
19+
description: "Whether to publish a package from the root folder to an npm registry"
2020
required: true
2121
type: boolean
22+
publish_subpackages:
23+
description: "comma separated list of subpackage folders to publish to an npm registry"
24+
required: false
25+
type: string
26+
default: ""
2227
tag_format:
2328
description: "The tag format to use for the release tags"
2429
required: false
@@ -70,6 +75,7 @@ jobs:
7075
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
7176
with:
7277
repository: NHSDigital/eps-common-workflows
78+
ref: AEA-6028
7379
sparse-checkout-cone-mode: false
7480
sparse-checkout: |
7581
package.json
@@ -230,7 +236,7 @@ jobs:
230236
name: config_artifact
231237

232238
- name: Cache asdf
233-
if: ${{ inputs.publish_package }}
239+
if: inputs.publish_package || inputs.publish_subpackages != ''
234240
uses: actions/cache@v5
235241
with:
236242
path: |
@@ -240,15 +246,15 @@ jobs:
240246
${{ runner.os }}-asdf-
241247
242248
- name: Install asdf dependencies in .tool-versions
243-
if: ${{ inputs.publish_package }}
249+
if: inputs.publish_package || inputs.publish_subpackages != ''
244250
uses: asdf-vm/actions/install@b7bcd026f18772e44fe1026d729e1611cc435d47
245251
with:
246252
asdf_version: ${{ inputs.asdfVersion }}
247253
env:
248254
PYTHON_CONFIGURE_OPTS: --enable-shared
249255

250256
- name: Install Dependencies and Build Package
251-
if: ${{ inputs.publish_package }}
257+
if: inputs.publish_package || inputs.publish_subpackages != ''
252258
run: |
253259
make install
254260
make build
@@ -315,6 +321,7 @@ jobs:
315321
GITHUB_TOKEN: ${{ github.token }}
316322
BRANCH_NAME: ${{ inputs.branch_name }}
317323
PUBLISH_PACKAGE: ${{ inputs.publish_package }}
324+
PUBLISH_SUBPACKAGES: ${{ inputs.publish_subpackages }}
318325
TAG_FORMAT: ${{ inputs.tag_format }}
319326
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
320327
MAIN_BRANCH: ${{ inputs.main_branch }}

release.config.cjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const { readFileSync } = require("fs")
33

44
const commitTemplate = readFileSync("./releaseNotesTemplates/commit.hbs").toString()
55
const publish_package = process.env.PUBLISH_PACKAGE === "true"
6+
const publish_subpackages = process.env.PUBLISH_SUBPACKAGES?.split(",").map(s => s.trim()).filter(s => s.length > 0) || []
67
const mainBranch = process.env.MAIN_BRANCH || "main"
78

89
module.exports = {
@@ -68,6 +69,12 @@ module.exports = {
6869
}
6970
],
7071
...(publish_package ? ["@semantic-release/npm"] : []),
72+
...publish_subpackages.map(subpackage => [
73+
"@semantic-release/npm",
74+
{
75+
pkgRoot: subpackage
76+
}
77+
]),
7178
[
7279
"@semantic-release/github",
7380
{

0 commit comments

Comments
 (0)