Skip to content

Commit e64095c

Browse files
committed
Deploy as package to GH packages
2 parents 1feabfc + 1bbd86e commit e64095c

7 files changed

Lines changed: 76 additions & 15 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish @wfp/common-identifier-algorithm-shared
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
- "v*.*.*-*"
8+
9+
permissions:
10+
checks: write
11+
contents: read
12+
packages: write
13+
pull-requests: read
14+
15+
jobs:
16+
test:
17+
uses: "./.github/workflows/test.yaml"
18+
publish:
19+
runs-on: ubuntu-latest
20+
needs:
21+
- test
22+
steps:
23+
- name: Checkout source
24+
uses: actions/checkout@v4
25+
26+
- name: Setup nodeJS
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: "24"
30+
registry-url: "https://npm.pkg.github.com"
31+
scope: "@wfp"
32+
33+
- name: Install dependencies
34+
run: npm install
35+
36+
- name: Build package
37+
run: npm run build
38+
39+
- name: Publish to GitHub packages
40+
run: npm publish
41+
env:
42+
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
name: RunTests
22
on:
33
push:
4-
branches: ['main', 'develop']
4+
branches:
5+
- main
6+
- develop
7+
- feat/*
58
pull_request:
69
branches: ['main']
710
types: [opened, reopened, edited]
11+
workflow_call:
12+
13+
permissions:
14+
checks: write
15+
contents: read
16+
pull-requests: read
817

918
jobs:
1019
RunTestSuite:
@@ -19,7 +28,7 @@ jobs:
1928
- name: Install NodeJS
2029
uses: actions/setup-node@v4
2130
with:
22-
node-version: 20
31+
node-version: 24
2332

2433
- name: Install node packages
2534
run: npm install

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@wfp:registry=https://npm.pkg.github.com
2+
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}

examples/example_algorithm/_generic_hasher.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
// You should have received a copy of the GNU Affero General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
import { joinFieldsForHash, cleanValueList, extractAlgoColumnsFromObject, BaseHasher } from 'common-identifier-algorithm-shared';
18-
import type { Config, Validator, makeHasherFunction } from 'common-identifier-algorithm-shared';
17+
import { joinFieldsForHash, cleanValueList, extractAlgoColumnsFromObject, BaseHasher } from '../../src';
18+
import type { Config, Validator, makeHasherFunction } from '../../src';
1919

2020
class GenericHasher extends BaseHasher {
2121
constructor(config: Config.CoreConfiguration["algorithm"]) {

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,34 @@
11
{
2-
"name": "common-identifier-algorithm-shared",
3-
"version": "1.2.0",
2+
"name": "@wfp/common-identifier-algorithm-shared",
3+
"version": "2.0.0",
44
"description": "Generate psuedonymous identifiers from tabular data",
55
"author": "World Food Programme",
66
"license": "AGPL-3.0-or-later",
77
"main": "dist/index.js",
88
"types": "dist/index.d.ts",
99
"files": [
10-
"dist"
10+
"dist",
11+
"README.md",
12+
"docs"
1113
],
1214
"type": "module",
1315
"scripts": {
1416
"build": "tsc",
1517
"watch": "tsc -w",
1618
"prepare": "npm run build",
19+
"clean": "git clean -xdf dist coverage",
20+
"clean:all": "git clean -xdf dist coverage node_modules",
21+
"publish:dry": "npm publish --dry-run",
1722
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage --config=jest.config.js",
1823
"test:ci": "node --experimental-vm-modules node_modules/jest/bin/jest.js --ci --coverage --config=jest.ci.config.js"
1924
},
2025
"repository": {
2126
"type": "git",
2227
"url": "git+https://github.com/wfp/common-identifier-algorithm-shared.git"
2328
},
29+
"publishConfig": {
30+
"registry": "https://npm.pkg.github.com"
31+
},
2432
"bugs": {
2533
"url": "https://github.com/wfp/common-identifier-algorithm-shared/issues"
2634
},

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@
2727
"declaration": true,
2828
},
2929
"include": ["src/**/*.ts"],
30-
"exclude": ["node_modules", "tests", "dist", "tmp", "examples"]
30+
"exclude": ["node_modules", "tests", "dist", "tmp"]
3131
}

0 commit comments

Comments
 (0)