Skip to content

Commit 56aa5ad

Browse files
committed
Publish TypeScript edge signing package
1 parent c93543c commit 56aa5ad

7 files changed

Lines changed: 169 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ jobs:
3131
with:
3232
node-version: '24'
3333

34-
- name: Run TypeScript package tests
35-
run: npm --prefix packages/ts test
34+
- name: Validate TypeScript package
35+
run: |
36+
npm --prefix packages/ts ci
37+
npm --prefix packages/ts test
38+
npm --prefix packages/ts run build
3639
3740
- name: Set up Python
3841
uses: actions/setup-python@v5
@@ -119,6 +122,62 @@ jobs:
119122
gh release create "${TAG_NAME}" dist/* --title "${TAG_NAME}" --notes "Release ${TAG_NAME}"
120123
fi
121124
125+
npm-package:
126+
name: Publish TypeScript package
127+
runs-on: ubuntu-latest
128+
needs: release
129+
130+
steps:
131+
- name: Check out repository
132+
uses: actions/checkout@v4
133+
134+
- name: Set up Node.js for GitHub Packages
135+
uses: actions/setup-node@v4
136+
with:
137+
node-version: '24'
138+
registry-url: https://npm.pkg.github.com
139+
scope: '@terion-name'
140+
cache: npm
141+
cache-dependency-path: packages/ts/package-lock.json
142+
143+
- name: Install TypeScript package dependencies
144+
run: npm --prefix packages/ts ci
145+
146+
- name: Test and build TypeScript package
147+
run: |
148+
npm --prefix packages/ts test
149+
npm --prefix packages/ts run build
150+
151+
- name: Check whether npm package version already exists
152+
id: npm_version
153+
working-directory: packages/ts
154+
env:
155+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
156+
TAG_NAME: ${{ github.ref_name }}
157+
run: |
158+
set -euo pipefail
159+
package_name="$(node -p "require('./package.json').name")"
160+
if npm view "${package_name}@${TAG_NAME}" version --registry=https://npm.pkg.github.com >/dev/null 2>&1; then
161+
echo "exists=true" >> "${GITHUB_OUTPUT}"
162+
echo "${package_name}@${TAG_NAME} already exists; skipping publish."
163+
else
164+
echo "exists=false" >> "${GITHUB_OUTPUT}"
165+
fi
166+
167+
- name: Set TypeScript package version from tag
168+
if: steps.npm_version.outputs.exists != 'true'
169+
working-directory: packages/ts
170+
env:
171+
TAG_NAME: ${{ github.ref_name }}
172+
run: npm version "${TAG_NAME}" --no-git-tag-version
173+
174+
- name: Publish TypeScript package to GitHub Packages
175+
if: steps.npm_version.outputs.exists != 'true'
176+
working-directory: packages/ts
177+
env:
178+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
179+
run: npm publish
180+
122181
docker-images:
123182
name: Build and publish ${{ matrix.app }} image
124183
runs-on: ubuntu-latest

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ __pycache__/
55
*.py[cod]
66
node_modules/
77
/deploy/certs/generated/
8+
packages/ts/dist/
9+
*.tgz

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ test:
1313
go test $(GO_PACKAGES)
1414

1515
ts-test:
16+
npm --prefix packages/ts ci
1617
npm --prefix packages/ts test
18+
npm --prefix packages/ts run build
1719

1820
python-test:
1921
PYTHONPATH=packages/python python3 -m unittest discover -s packages/python/tests

packages/ts/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# @terion-name/air3-edgesign
2+
3+
TypeScript helpers for signing and verifying air3 edge gateway URLs.
4+
5+
```sh
6+
npm install @terion-name/air3-edgesign --registry=https://npm.pkg.github.com
7+
```
8+
9+
```ts
10+
import { signUrl, verifyUrl } from '@terion-name/air3-edgesign';
11+
```
12+
13+
This package is published to GitHub Packages by the tag release workflow. The published runtime entry point is built JavaScript in `dist/` with TypeScript declarations.

packages/ts/package-lock.json

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

packages/ts/package.json

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,38 @@
11
{
2-
"name": "@air3/edgesign",
3-
"private": true,
2+
"name": "@terion-name/air3-edgesign",
3+
"version": "0.0.0",
4+
"description": "TypeScript helpers for signing and verifying air3 edge gateway URLs.",
5+
"license": "UNLICENSED",
46
"type": "module",
7+
"main": "./dist/index.js",
8+
"module": "./dist/index.js",
9+
"types": "./dist/index.d.ts",
510
"exports": {
6-
".": "./src/index.ts"
11+
".": {
12+
"types": "./dist/index.d.ts",
13+
"import": "./dist/index.js"
14+
}
15+
},
16+
"files": [
17+
"dist/"
18+
],
19+
"repository": {
20+
"type": "git",
21+
"url": "git+https://github.com/terion-name/air3.git",
22+
"directory": "packages/ts"
23+
},
24+
"publishConfig": {
25+
"registry": "https://npm.pkg.github.com"
726
},
827
"scripts": {
9-
"test": "node --test --experimental-strip-types test/*.test.ts"
28+
"test": "node --test --experimental-strip-types test/*.test.ts",
29+
"build": "tsc -p tsconfig.build.json"
1030
},
1131
"engines": {
1232
"node": ">=22.6"
33+
},
34+
"devDependencies": {
35+
"@types/node": "^24.0.0",
36+
"typescript": "^5.8.0"
1337
}
1438
}

packages/ts/tsconfig.build.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"declaration": true,
5+
"emitDeclarationOnly": false,
6+
"noEmit": false,
7+
"outDir": "dist",
8+
"rootDir": "src"
9+
},
10+
"include": ["src/**/*.ts"],
11+
"exclude": ["test/**/*.ts"]
12+
}

0 commit comments

Comments
 (0)