-
Notifications
You must be signed in to change notification settings - Fork 5
68 lines (64 loc) · 1.7 KB
/
typescript-sdk.yml
File metadata and controls
68 lines (64 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: TypeScript SDK
on:
pull_request:
paths:
- ".github/workflows/typescript-sdk.yml"
- "sdk/typescript/**"
push:
branches:
- main
paths:
- ".github/workflows/typescript-sdk.yml"
- "sdk/typescript/**"
tags:
- "redis-afs-v*"
workflow_dispatch:
permissions:
contents: read
jobs:
test:
name: Test package
runs-on: ubuntu-latest
defaults:
run:
working-directory: sdk/typescript
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: "24"
cache: npm
cache-dependency-path: sdk/typescript/package-lock.json
- run: npm ci
- run: npm test
- run: npm run pack:dry-run
publish:
name: Publish package
needs: test
if: startsWith(github.ref, 'refs/tags/redis-afs-v')
runs-on: ubuntu-latest
environment: npm
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: sdk/typescript
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
cache: npm
cache-dependency-path: sdk/typescript/package-lock.json
- run: npm ci
- name: Verify tag matches package version
run: |
package_version="$(node -p "require('./package.json').version")"
tag_version="${GITHUB_REF_NAME#redis-afs-v}"
if [ "$package_version" != "$tag_version" ]; then
echo "Tag redis-afs-v${tag_version} does not match package.json version ${package_version}."
exit 1
fi
- run: npm publish