@tiledesk/tiledesk-server 2.22.2 → 2.22.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/deploynew.sh +32 -12
  2. package/package.json +1 -1
package/deploynew.sh CHANGED
@@ -1,12 +1,17 @@
1
1
  #!/bin/bash
2
+ set -euo pipefail
2
3
 
3
- # Load .env variables
4
- if [ -f .env ]; then
5
- export $(grep -v '^#' .env | xargs)
4
+ # Load only what this script needs from .env (full-file export breaks on
5
+ # values with spaces/special chars, and with set -e it aborts immediately)
6
+ if [ -z "${NPM_PUBLISH_TOKEN:-}" ] && [ -f .env ]; then
7
+ NPM_PUBLISH_TOKEN=$(grep -E '^[[:space:]]*NPM_PUBLISH_TOKEN=' .env | tail -n1 | cut -d= -f2- | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/^"//' -e 's/"$//' -e "s/^'//" -e "s/'$//")
8
+ export NPM_PUBLISH_TOKEN
6
9
  fi
7
10
 
11
+ REMOTE="${GIT_REMOTE:-tiledesk-server}"
12
+
8
13
  # Check if the token is set
9
- if [ -z "$NPM_PUBLISH_TOKEN" ]; then
14
+ if [ -z "${NPM_PUBLISH_TOKEN:-}" ]; then
10
15
  echo "⚠️ Missing NPM_PUBLISH_TOKEN in environment."
11
16
  echo "You can speed up the process by setting the environment variable with your publish token."
12
17
  read -p "Do you want to continue with manual login? (y/n): " choice
@@ -36,17 +41,32 @@ if [[ "$VERSION_TYPE" != "patch" && "$VERSION_TYPE" != "minor" && "$VERSION_TYPE
36
41
  fi
37
42
 
38
43
  echo "📦 Bumping version: $VERSION_TYPE"
39
- npm version $VERSION_TYPE
40
- version=`node -e 'console.log(require("./package.json").version)'`
44
+ # --force: allow bump with local uncommitted changes (e.g. this script).
45
+ # npm version still only commits package.json / lockfile.
46
+ npm version "$VERSION_TYPE" --force
47
+ version=$(node -e 'console.log(require("./package.json").version)')
41
48
  echo "version $version"
42
49
 
43
- if [ "$version" != "" ]; then
44
- git tag -a "$version" -m "`git log -1 --format=%s`"
45
- echo "Created a new tag, $version"
46
- git push --tags
47
- npm publish --access public
50
+ if [ -z "$version" ]; then
51
+ echo "❌ Could not read version from package.json"
52
+ exit 1
48
53
  fi
49
- git push
54
+
55
+ # npm version already creates tag v$version; also create $version for Docker workflows
56
+ if ! git rev-parse -q --verify "refs/tags/$version" >/dev/null; then
57
+ git tag -a "$version" -m "$(git log -1 --format=%s)"
58
+ echo "Created a new tag, $version"
59
+ else
60
+ echo "Tag $version already exists"
61
+ fi
62
+
63
+ # Push branch first, then ONLY this release's tags (never git push --tags:
64
+ # it can fail on unrelated local tags or send a huge pack → HTTP 400)
65
+ echo "🚀 Pushing branch and release tags to $REMOTE..."
66
+ git push "$REMOTE" HEAD
67
+ git push "$REMOTE" "refs/tags/$version" "refs/tags/v$version"
68
+
69
+ npm publish --access public
50
70
 
51
71
  # Remove temporary .npmrc if created
52
72
  if [ -f ~/.npmrc ]; then
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-server",
3
3
  "description": "The Tiledesk server module",
4
- "version": "2.22.2",
4
+ "version": "2.22.7",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",