@@ -3,7 +3,7 @@ name: Publish to npm
33on :
44 push :
55 branches :
6- - main # Run when a push is made to the main branch
6+ - main # Run when a push is made to the main branch
77
88jobs :
99 build-and-publish :
1515 - name : Setup Node.js
1616 uses : actions/setup-node@v4
1717 with :
18- node-version : ' 22 '
19- registry-url : ' https://registry.npmjs.org/'
20- scope : ' @bytebase'
18+ node-version : " 22 "
19+ registry-url : " https://registry.npmjs.org/"
20+ scope : " @bytebase"
2121
2222 - name : Install pnpm
2323 uses : pnpm/action-setup@v3
@@ -34,25 +34,24 @@ jobs:
3434 run : |
3535 # Get the current version from package.json
3636 CURRENT_VERSION=$(jq -r '.version' package.json)
37-
38- # Generate a version with date and commit hash suffix
39- COMMIT_HASH=$(git rev-parse --short HEAD)
37+
38+ # Generate a version with date
4039 DATE_VERSION=$(date +'%Y%m%d')
41- VERSION="${CURRENT_VERSION}-${DATE_VERSION}.${COMMIT_HASH} "
42-
40+ VERSION="${CURRENT_VERSION}-${DATE_VERSION}"
41+
4342 # Update package.json to use @bytebase scope and set version
4443 jq --arg version "$VERSION" '.name = "@bytebase/dbhub" | .version = $version' package.json > package.json.tmp
4544 mv package.json.tmp package.json
46-
45+
4746 # Set files to include in the package
4847 jq '.files = ["dist/**/*", "LICENSE", "README.md"]' package.json > package.json.tmp
4948 mv package.json.tmp package.json
50-
49+
5150 # Add bin entry for CLI usage
5251 jq '.bin = {"dbhub": "dist/index.js"}' package.json > package.json.tmp
5352 mv package.json.tmp package.json
5453
5554 - name : Publish to npm
5655 run : pnpm publish --no-git-checks --access public --tag dev
5756 env :
58- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
57+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments