zet-api 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,80 @@
1
+ name: Publish to NPM (OIDC)
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - 'src/**'
9
+ - 'package.json'
10
+ - 'tsconfig.json'
11
+ - 'pnpm-lock.yaml'
12
+ workflow_dispatch:
13
+
14
+ permissions:
15
+ id-token: write
16
+ contents: read
17
+
18
+ jobs:
19
+ publish:
20
+ runs-on: ubuntu-latest
21
+
22
+ steps:
23
+ - name: Checkout code
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Set up Node.js
27
+ uses: actions/setup-node@v4
28
+ with:
29
+ node-version: '20'
30
+ registry-url: 'https://registry.npmjs.org'
31
+ always-auth: true
32
+
33
+ - name: Ensure latest npm
34
+ run: npm install -g npm@latest
35
+
36
+ - name: Install pnpm
37
+ uses: pnpm/action-setup@v3
38
+ with:
39
+ version: latest
40
+
41
+ - name: Cache pnpm store
42
+ uses: actions/cache@v3
43
+ with:
44
+ path: ~/.pnpm-store
45
+ key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
46
+ restore-keys: |
47
+ ${{ runner.os }}-pnpm-
48
+
49
+ - name: Install dependencies
50
+ run: pnpm install --frozen-lockfile
51
+
52
+ - name: Check if package needs publishing
53
+ id: check_publish
54
+ run: |
55
+ current_version=$(node -p "require('./package.json').version")
56
+ package_name=$(node -p "require('./package.json').name")
57
+ published_version=$(npm view $package_name version 2>/dev/null || echo "0.0.0")
58
+
59
+ echo "Current version: $current_version"
60
+ echo "Published version: $published_version"
61
+
62
+ if [ "$current_version" == "$published_version" ]; then
63
+ echo "No new version. Skipping publish."
64
+ echo "should_publish=false" >> $GITHUB_OUTPUT
65
+ else
66
+ echo "New version available. Proceeding to publish."
67
+ echo "should_publish=true" >> $GITHUB_OUTPUT
68
+ fi
69
+
70
+ - name: Run linting
71
+ if: steps.check_publish.outputs.should_publish == 'true'
72
+ run: pnpm run lint
73
+
74
+ - name: Build the project
75
+ if: steps.check_publish.outputs.should_publish == 'true'
76
+ run: pnpm run build
77
+
78
+ - name: Publish to NPM using OIDC
79
+ if: steps.check_publish.outputs.should_publish == 'true'
80
+ run: pnpm publish --access public --no-git-checks --provenance