sync API version with PeerTube version and auto-update it via git hooks
authorRigel Kent <sendmemail@rigelk.eu>
Tue, 13 Nov 2018 13:31:31 +0000 (14:31 +0100)
committerRigel Kent <sendmemail@rigelk.eu>
Tue, 13 Nov 2018 13:31:48 +0000 (14:31 +0100)
package.json
scripts/openapi-peertube-version.sh [new file with mode: 0755]
support/doc/api/openapi.yaml

index bc514920de8e71fac033df268713ec8c3c0711cd..3c77b93cbf8fc056e51de5a576a0e61e05810f90 100644 (file)
@@ -71,7 +71,7 @@
   },
   "husky": {
     "hooks": {
-      "pre-commit": "lint-staged"
+      "pre-commit": "lint-staged && ./scripts/openapi-peertube-version.sh"
     }
   },
   "lint-staged": {
diff --git a/scripts/openapi-peertube-version.sh b/scripts/openapi-peertube-version.sh
new file mode 100755 (executable)
index 0000000..c638291
--- /dev/null
@@ -0,0 +1,4 @@
+# Version key/value should be on his own line
+PACKAGE_VERSION=$(node -p "require('./package.json').version")
+
+sed -i "s/\(^\s*\)version: .*/\1version: $PACKAGE_VERSION/" support/doc/api/openapi.yaml
index 59ca8b29a9305f16a8fe3af1fd50fac86c05fff9..f3520a7b1799371a2ee399dba88b789cf2ec3c06 100644 (file)
@@ -1,7 +1,7 @@
 swagger: '2.0'
 info:
   title: PeerTube
-  version: 1.0.0-beta
+  version: 1.1.0-alpha.2
   description: Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.
 host: peertube.example.com
 securityDefinitions: