Skip to content

Commit 64f7cd0

Browse files
authored
Merge pull request #39 from dimitrovs/next
Add GitHub Actions workflow for publishing package on version tags
2 parents c15b565 + 34b4546 commit 64f7cd0

6 files changed

Lines changed: 105 additions & 1788 deletions

File tree

.claude/settings.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
"Bash(npm run test:coverage)",
55
"Bash(pnpm --version)",
66
"Bash(pnpm install)",
7-
"Bash(pnpm test)"
7+
"Bash(pnpm test)",
8+
"Bash(pnpm info typedoc versions --json)",
9+
"Bash(pnpm info typedoc@0.28 version)",
10+
"WebFetch(domain:github.com)",
11+
"Bash(pnpm add -D typedoc@^0.28.0)",
12+
"Bash(pnpm run build)",
13+
"Bash(npx typedoc)"
814
]
915
}
1016
}

.github/workflows/ci.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,3 @@ jobs:
1616
cache: 'pnpm'
1717
- run: pnpm install
1818
- run: pnpm run dist
19-
release:
20-
needs: test
21-
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
22-
runs-on: ubuntu-latest
23-
steps:
24-
- uses: actions/checkout@v4
25-
- uses: pnpm/action-setup@v4
26-
- uses: actions/setup-node@v4
27-
with:
28-
node-version: 'lts/*'
29-
cache: 'pnpm'
30-
- run: pnpm install
31-
- run: npx semantic-release
32-
env:
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/doc.workflow.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ on:
33
push:
44
branches:
55
- master
6+
permissions:
7+
contents: read
8+
pages: write
9+
id-token: write
610
jobs:
711
build:
8-
name: Publishing UHST Server Node Docs to GitHub pages
9-
env:
10-
my_secret: ${{secrets.COMMIT_SECRET}}
12+
name: Build docs
1113
runs-on: ubuntu-latest
1214
steps:
1315
- uses: actions/checkout@v4
@@ -16,21 +18,19 @@ jobs:
1618
with:
1719
node-version: '20'
1820
cache: 'pnpm'
19-
- run: |
20-
pnpm install
21-
pnpm run dist
22-
cd docs
23-
touch .nojekyll
24-
git init
25-
# type configurations: your user.email and user.name followed lines
26-
# git config --global user.email your_email
27-
# git config --global user.name your_name
28-
git config --global user.email ${{secrets.USER_EMAIL}}
29-
git config --global user.name ${{secrets.USER_NAME}}
30-
git status
31-
# change this remote url for examle your remote url is then the following:
32-
git remote add origin https://${{secrets.COMMIT_SECRET}}@github.com/uhst/uhst-server-node.git
33-
git checkout -b gh-pages
34-
git add --all
35-
git commit -m "docs"
36-
git push origin gh-pages -f
21+
- run: pnpm install
22+
- run: pnpm run dist
23+
- run: touch docs/.nojekyll
24+
- uses: actions/upload-pages-artifact@v3
25+
with:
26+
path: docs
27+
deploy:
28+
name: Deploy to GitHub Pages
29+
needs: build
30+
runs-on: ubuntu-latest
31+
environment:
32+
name: github-pages
33+
url: ${{ steps.deployment.outputs.page_url }}
34+
steps:
35+
- id: deployment
36+
uses: actions/deploy-pages@v4

.github/workflows/publish.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish Package
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
id-token: write
10+
contents: write
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: pnpm/action-setup@v4
19+
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 'lts/*'
23+
registry-url: 'https://registry.npmjs.org'
24+
25+
- run: pnpm install
26+
27+
- run: pnpm run dist
28+
29+
- name: Set package version from tag
30+
run: npm version "${GITHUB_REF_NAME#v}" --no-git-tag-version --allow-same-version
31+
working-directory: dist
32+
33+
- name: Publish to npm
34+
run: pnpm publish --provenance --access public --no-git-checks
35+
working-directory: dist
36+
37+
- name: Create GitHub Release
38+
run: gh release create "$GITHUB_REF_NAME" --generate-notes
39+
env:
40+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
"test": "pnpm run clean && pnpm run build && mocha dist/test/**/*.test.js --exit",
1717
"test:coverage": "nyc mocha test/**/*.test.ts --require ts-node/register --exit",
1818
"test-watch": "pnpm run clean && tsc-watch --onSuccess \"mocha dist/test/**/*.test.js\"",
19-
"dist": "pnpm test && copyfiles bin/* package.json README.md LICENSE dist && typedoc",
20-
"semantic-release": "semantic-release"
19+
"dist": "pnpm test && copyfiles bin/* package.json README.md LICENSE dist && typedoc"
2120
},
2221
"repository": {
2322
"type": "git",
@@ -61,23 +60,16 @@
6160
"nodemon": "^3.1.0",
6261
"nyc": "^17.1.0",
6362
"proxyquire": "^2.1.3",
64-
"semantic-release": "^24.0.0",
63+
6564
"sinon": "^21.0.1",
6665
"supertest": "^7.0.0",
6766
"ts-node": "^10.9.0",
6867
"tsc-watch": "^6.2.0",
69-
"typedoc": "^0.27.0",
68+
"typedoc": "^0.28.17",
7069
"typescript": "^5.7.0"
7170
},
7271
"engines": {
7372
"node": ">=18.0.0"
7473
},
75-
"packageManager": "pnpm@10.18.3",
76-
"release": {
77-
"pkgRoot": "dist",
78-
"assets": [
79-
"dist/*.zip",
80-
"dist/*.tar.gz"
81-
]
82-
}
74+
"packageManager": "pnpm@10.18.3"
8375
}

0 commit comments

Comments
 (0)