From a1dd0b3ceffedcf779a4e45fa9bdf1eced6fff23 Mon Sep 17 00:00:00 2001 From: Igor Date: Fri, 6 Oct 2023 16:34:20 +0100 Subject: [PATCH] Publish node REST client library as a GitHub Package --- .github/workflows/publish-node-client.yml | 38 +++++++++++++++++++++++ clients/node/package-lock.json | 4 +-- clients/node/package.json | 7 +++-- 3 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/publish-node-client.yml diff --git a/.github/workflows/publish-node-client.yml b/.github/workflows/publish-node-client.yml new file mode 100644 index 00000000..c0ca8fdd --- /dev/null +++ b/.github/workflows/publish-node-client.yml @@ -0,0 +1,38 @@ +name: Publish node REST client package +on: + release: + types: [published] +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: '18.x' + registry-url: 'https://npm.pkg.github.com' + scope: '@ministryofjustice' + - name: Install dependencies + run: | + cd clients/node + npm clean-install --no-audit + - name: Run tests + run: | + cd clients/node + npm test + - name: Build package + run: | + cd clients/node + npm run clean + npm run build + - name: Publish package + run: | + cd clients/node + npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/clients/node/package-lock.json b/clients/node/package-lock.json index 8fecd132..24a7627b 100644 --- a/clients/node/package-lock.json +++ b/clients/node/package-lock.json @@ -1,11 +1,11 @@ { - "name": "hmpps-non-associations-api", + "name": "@ministryofjustice/hmpps-non-associations-api", "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "hmpps-non-associations-api", + "name": "@ministryofjustice/hmpps-non-associations-api", "version": "0.0.0", "license": "MIT", "dependencies": { diff --git a/clients/node/package.json b/clients/node/package.json index edaeac13..69d43fe1 100644 --- a/clients/node/package.json +++ b/clients/node/package.json @@ -1,5 +1,5 @@ { - "name": "hmpps-non-associations-api", + "name": "@ministryofjustice/hmpps-non-associations-api", "version": "0.0.0", "private": false, "description": "HMPPS Non-associations API REST client", @@ -9,7 +9,10 @@ "url": "https://mojdigital.blog.gov.uk/" }, "homepage": "https://github.com/ministryofjustice/hmpps-non-associations-api", - "repository": "git@github.com:ministryofjustice/hmpps-non-associations-api.git", + "repository": { + "type": "git", + "url": "git+https://github.com/ministryofjustice/hmpps-non-associations-api.git" + }, "license": "MIT", "main": "dist/index.js", "types": "dist/index.d.ts",