File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Publish Package
2
+
3
+ on :
4
+ # Trigger workflow when a tag starting with 'v' is pushed (e.g., v1.0.0)
5
+ push :
6
+ tags :
7
+ - ' v*.*.*'
8
+
9
+ jobs :
10
+ publish :
11
+ runs-on : ubuntu-latest
12
+
13
+ steps :
14
+ # Step 1: Check out the repository code
15
+ - name : Checkout repository
16
+ uses : actions/checkout@v3
17
+
18
+ # Step 2: Set up the Node.js environment
19
+ - name : Setup Node.js environment
20
+ uses : actions/setup-node@v3
21
+ with :
22
+ node-version : ' 18' # Specify Node.js version (change if needed)
23
+ registry-url : ' https://registry.npmjs.org/' # Set the registry URL for npm
24
+
25
+ # Step 3: Install project dependencies
26
+ - name : Install dependencies
27
+ run : npm ci
28
+
29
+ # Step 4: Build the project (compile TypeScript or run your build script)
30
+ - name : Build project
31
+ run : npm run build
32
+
33
+ # Step 5: Run tests to ensure the package works correctly before publishing
34
+ # name: Run tests
35
+ # run: npm test
36
+
37
+ # Step 6: Publish the package to npm using the provided token
38
+ - name : Publish package to npm
39
+ run : npm publish
40
+ env :
41
+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }} # Use the secret stored in GitHub repo secrets
You can’t perform that action at this time.
0 commit comments