Explorar o código

Include version number in release archive

The `package.sh` script now creates archives named
`threema-web-X.Y.Z.tar.gz` instead of `release.tar.gz`.
Danilo Bargen %!s(int64=8) %!d(string=hai) anos
pai
achega
02ed4e0057
Modificáronse 2 ficheiros con 17 adicións e 13 borrados
  1. 16 12
      dist/package.sh
  2. 1 1
      docs/self_hosting.md

+ 16 - 12
dist/package.sh

@@ -28,15 +28,18 @@ if [ -e "release" ]; then
     done
 fi
 
+VERSION=$(grep "\"version\"" package.json  | sed 's/\s*\"version\": \"\([^\"]*\).*/\1/')
+DIR="release/threema-web-$VERSION"
+
 echo "+ Create release directory..."
-mkdir -p release/{dist,partials,directives,node_modules,partials/messenger.receiver,files}
+mkdir -p $DIR/{dist,partials,directives,node_modules,partials/messenger.receiver,files}
 
 echo "+ Copy code..."
-cp -R index.html dist/ release/
-cp -R public/* release/
-cp -R src/partials/*.html release/partials/
-cp -R src/partials/messenger.receiver/*.html release/partials/messenger.receiver/
-cp -R src/directives/*.html release/directives/
+cp -R index.html dist/ $DIR/
+cp -R public/* $DIR/
+cp -R src/partials/*.html $DIR/partials/
+cp -R src/partials/messenger.receiver/*.html $DIR/partials/messenger.receiver/
+cp -R src/directives/*.html $DIR/directives/
 
 echo "+ Copy dependencies..."
 targets=(
@@ -73,18 +76,19 @@ targets=(
 )
 
 for target in "${targets[@]}"; do
-    install -D "node_modules/$target" "release/node_modules/$target"
+    install -D "node_modules/$target" "$DIR/node_modules/$target"
 done
 
 echo "+ Update version number..."
-VERSION=$(grep "\"version\"" package.json  | sed 's/\s*\"version\": \"\([^\"]*\).*/\1/')
-sed -i "s/\[\[VERSION\]\]/${VERSION}/g" release/index.html release/dist/app.js
+sed -i "s/\[\[VERSION\]\]/${VERSION}/g" $DIR/index.html $DIR/dist/app.js
 
 echo "+ Update permissions..."
-find release/ -type f -exec chmod 644 {} \;
-find release/ -type d -exec chmod 755 {} \;
+find $DIR/ -type f -exec chmod 644 {} \;
+find $DIR/ -type d -exec chmod 755 {} \;
 
 echo "+ Put everything in an archive..."
-tar cfz dist/release.tar.gz release/
+cd release
+tar cfz "../dist/threema-web-$VERSION.tar.gz" $(basename "$DIR")
+cd ..
 
 echo -e "\nDone."

+ 1 - 1
docs/self_hosting.md

@@ -39,7 +39,7 @@ Then, build the release version of Threema Web:
     npm install
     npm run dist
 
-Finally, unpack the `dist/release.tar.gz` archive to your web server directory.
+Finally, unpack the `dist/threema-web-[VERSION].tar.gz` archive to your web server directory.
 Make sure to serve Threema Web only via https. We also recommend to enable
 HSTS, HPKP, CSP and other available security mechanisms in your web server.