Skip to content

Commit ea8990c

Browse files
committed
Typescript build & publish
1 parent 543abd5 commit ea8990c

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

.github/workflows/typescript.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ jobs:
1717

1818
steps:
1919
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
- name: Get version from git tag
23+
id: version
24+
run: |
25+
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.1-preview")
26+
VERSION=${VERSION#v}
27+
echo "version=$VERSION" >> $GITHUB_OUTPUT
2028
- name: Setup Node.js
2129
uses: actions/setup-node@v4
2230
with:
@@ -26,9 +34,42 @@ jobs:
2634
- name: Install dependencies
2735
run: npm ci
2836
working-directory: src/Typescript
37+
- name: Set package version
38+
run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version --allow-same-version
39+
working-directory: src/Typescript
2940
- name: Build
3041
run: npm run build
3142
working-directory: src/Typescript
3243
- name: Test
3344
run: npm test
3445
working-directory: src/Typescript
46+
- name: Pack npm package
47+
run: npm pack
48+
working-directory: src/Typescript
49+
- name: Upload npm package
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: npm-package
53+
path: src/Typescript/*.tgz
54+
55+
deploy:
56+
runs-on: ubuntu-latest
57+
needs: build
58+
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
59+
environment: npm-production
60+
61+
steps:
62+
- name: Download npm package
63+
uses: actions/download-artifact@v4
64+
with:
65+
name: npm-package
66+
path: ./package
67+
- name: Setup Node.js
68+
uses: actions/setup-node@v4
69+
with:
70+
node-version: '20'
71+
registry-url: 'https://registry.npmjs.org'
72+
- name: Publish to npm
73+
run: npm publish ./package/*.tgz --access public
74+
env:
75+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

src/Typescript/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"security",
2121
"typescript"
2222
],
23-
"author": "Your Name",
23+
"author": "Rock Solid Knowledge",
2424
"license": "MIT",
2525
"devDependencies": {
2626
"@babel/core": "^7.28.3",
@@ -44,6 +44,6 @@
4444
],
4545
"repository": {
4646
"type": "git",
47-
"url": "https://github.com/yourusername/authzen-client.git"
47+
"url": "https://github.com/RockSolidKnowledge/AuthZenClient.git"
4848
}
4949
}

0 commit comments

Comments
 (0)