File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -34,10 +34,15 @@ jobs:
3434 run : |
3535 # Get the current version from package.json
3636 CURRENT_VERSION=$(jq -r '.version' package.json)
37-
38- # Generate a version
39- VERSION="${CURRENT_VERSION}"
40-
37+
38+ # Generate a version with just the date suffix
39+ DATE_VERSION=$(date +'%Y%m%d')
40+ VERSION="${CURRENT_VERSION}-${DATE_VERSION}"
41+
42+ # Store the version and package name in environment variables for later steps
43+ echo "PACKAGE_VERSION=${VERSION}" >> $GITHUB_ENV
44+ echo "PACKAGE_NAME=@bytebase/dbhub" >> $GITHUB_ENV
45+
4146 # Update package.json to use @bytebase scope and set version
4247 jq --arg version "$VERSION" '.name = "@bytebase/dbhub" | .version = $version' package.json > package.json.tmp
4348 mv package.json.tmp package.json
5055 jq '.bin = {"dbhub": "dist/index.js"}' package.json > package.json.tmp
5156 mv package.json.tmp package.json
5257
58+ - name : Try to unpublish existing daily version
59+ run : |
60+ # Try to unpublish any existing package with the same version from today
61+ # The || true ensures the workflow continues even if the package doesn't exist
62+ npm unpublish ${{ env.PACKAGE_NAME }}@${{ env.PACKAGE_VERSION }} || true
63+ env :
64+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
65+
5366 - name : Publish to npm
5467 run : pnpm publish --no-git-checks --access public --tag dev
5568 env :
You can’t perform that action at this time.
0 commit comments