Skip to content

Commit b796bec

Browse files
New: [AEA-6028] - Added option for publishing sub-packages (#46)
## Summary - ✨ New Feature
1 parent e5c6c80 commit b796bec

File tree

5 files changed

+21
-14
lines changed

5 files changed

+21
-14
lines changed

.github/workflows/pull_request.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,5 @@ jobs:
4747
dry_run: true
4848
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
4949
branch_name: ${{ github.event.pull_request.head.ref }}
50-
publish_package: false
5150
tag_format: ${{ needs.get_asdf_version.outputs.tag_format }}
5251
secrets: inherit

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,5 @@ jobs:
3939
dry_run: false
4040
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
4141
branch_name: main
42-
publish_package: false
4342
tag_format: ${{ needs.get_asdf_version.outputs.tag_format }}
4443
secrets: inherit

.github/workflows/tag-release.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ on:
1515
type: string
1616
required: false
1717
default: "0.18.0"
18-
publish_package:
19-
description: "Whether to publish a package to an npm registry"
20-
required: true
21-
type: boolean
18+
publish_packages:
19+
description: "comma separated list of package folders to publish to an npm registry"
20+
required: false
21+
type: string
22+
default: ""
2223
tag_format:
2324
description: "The tag format to use for the release tags"
2425
required: false
@@ -230,7 +231,7 @@ jobs:
230231
name: config_artifact
231232

232233
- name: Cache asdf
233-
if: ${{ inputs.publish_package }}
234+
if: inputs.publish_packages != ''
234235
uses: actions/cache@v5
235236
with:
236237
path: |
@@ -240,15 +241,15 @@ jobs:
240241
${{ runner.os }}-asdf-
241242
242243
- name: Install asdf dependencies in .tool-versions
243-
if: ${{ inputs.publish_package }}
244+
if: inputs.publish_packages != ''
244245
uses: asdf-vm/actions/install@b7bcd026f18772e44fe1026d729e1611cc435d47
245246
with:
246247
asdf_version: ${{ inputs.asdfVersion }}
247248
env:
248249
PYTHON_CONFIGURE_OPTS: --enable-shared
249250

250251
- name: Install Dependencies and Build Package
251-
if: ${{ inputs.publish_package }}
252+
if: inputs.publish_packages != ''
252253
run: |
253254
make install
254255
make build
@@ -314,7 +315,7 @@ jobs:
314315
env:
315316
GITHUB_TOKEN: ${{ github.token }}
316317
BRANCH_NAME: ${{ inputs.branch_name }}
317-
PUBLISH_PACKAGE: ${{ inputs.publish_package }}
318+
PUBLISH_PACKAGES: ${{ inputs.publish_packages }}
318319
TAG_FORMAT: ${{ inputs.tag_format }}
319320
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
320321
MAIN_BRANCH: ${{ inputs.main_branch }}
@@ -325,7 +326,7 @@ jobs:
325326
env:
326327
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
327328
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
328-
PUBLISH_PACKAGE: ${{ inputs.publish_package }}
329+
PUBLISH_PACKAGES: ${{ inputs.publish_packages }}
329330
TAG_FORMAT: ${{ inputs.tag_format }}
330331
MAIN_BRANCH: ${{ inputs.main_branch }}
331332
EXTRA_ASSET: ${{ inputs.extra_artifact_name }}

release.config.cjs

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

44
const commitTemplate = readFileSync("./releaseNotesTemplates/commit.hbs").toString()
5-
const publish_package = process.env.PUBLISH_PACKAGE === "true"
5+
const publish_packages = process.env.PUBLISH_PACKAGES?.split(",").map(s => s.trim()).filter(s => s.length > 0) || []
66
const mainBranch = process.env.MAIN_BRANCH || "main"
77

88
module.exports = {
@@ -67,7 +67,12 @@ module.exports = {
6767
changelogFile: "CHANGELOG.md"
6868
}
6969
],
70-
...(publish_package ? ["@semantic-release/npm"] : []),
70+
...publish_packages.map(subpackage => [
71+
"@semantic-release/npm",
72+
{
73+
pkgRoot: subpackage
74+
}
75+
]),
7176
[
7277
"@semantic-release/github",
7378
{

sonar-project.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
sonar.organization=nhsdigital
22
sonar.projectKey=NHSDigital_eps-common-workflows
3-
sonar.host.url=https://sonarcloud.io
3+
sonar.host.url=https://sonarcloud.io
4+
5+
sonar.coverage.exclusions=\
6+
release.config.cjs

0 commit comments

Comments
 (0)