Skip to content

Commit d1f3d22

Browse files
committed
AEA-5986 Add pypi plugin to semantic release.
1 parent 8404cf6 commit d1f3d22

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

.github/workflows/tag-release.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ on:
4646
description: "An repository for the extra artifact"
4747
required: false
4848
type: string
49+
pypi_publish:
50+
description: "Whether to publish to PyPI"
51+
required: false
52+
type: boolean
53+
default: false
54+
pypi_test_publish:
55+
description: "Whether to publish to Test PyPI"
56+
required: false
57+
type: boolean
58+
default: false
4959
outputs:
5060
version_tag:
5161
value: ${{ jobs.tag_release.outputs.version_tag }}
@@ -71,6 +81,7 @@ jobs:
7181
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
7282
with:
7383
repository: NHSDigital/eps-common-workflows
84+
ref: aea-5986-publish-fame-library
7485
sparse-checkout-cone-mode: false
7586
sparse-checkout: |
7687
package.json
@@ -249,7 +260,7 @@ jobs:
249260
PYTHON_CONFIGURE_OPTS: --enable-shared
250261

251262
- name: Install Dependencies and Build Package
252-
if: inputs.publish_packages != ''
263+
if: inputs.publish_packages != '' || inputs.pypi_publish != ''
253264
run: |
254265
make install
255266
make build
@@ -320,6 +331,8 @@ jobs:
320331
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
321332
MAIN_BRANCH: ${{ inputs.main_branch }}
322333
EXTRA_ASSET: ${{ inputs.extra_artifact_name }}
334+
PYPI_PUBLISH: ${{ inputs.pypi_publish }}
335+
PYPI_TEST_PUBLISH: ${{ inputs.pypi_test_publish }}
323336

324337
- name: Create semantic release tag
325338
if: ${{ !inputs.dry_run }}

release.config.cjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ const commitTemplate = readFileSync("./releaseNotesTemplates/commit.hbs").toStri
55
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

8+
const pypiPublish = process.env.PYPI_PUBLISH || false
9+
const pypiTestPublish = process.env.PYPI_TEST_PUBLISH || false
10+
const pypiRepoUrl = pypiTestPublish ? "https://test.pypi.org/legacy/" : "https://upload.pypi.org/legacy/"
11+
812
module.exports = {
913
branches: [
1014
{
@@ -73,6 +77,13 @@ module.exports = {
7377
pkgRoot: subpackage
7478
}
7579
]),
80+
[
81+
"semantic-release-pypi",
82+
{
83+
pypiPublish, pypiPublish,
84+
repoUrl: pypiRepoUrl
85+
}
86+
],
7687
[
7788
"@semantic-release/github",
7889
{

0 commit comments

Comments
 (0)