@arcadible/github-release-tools 0.1.0 → 0.1.2

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.
@@ -2,8 +2,8 @@
2
2
  set -e
3
3
  SCRIPT="$(realpath "$0")"
4
4
  DIR="$(dirname "$SCRIPT")"
5
- RESULT=$(node "$DIR/../src/assert-tag.js" "$1")
5
+ RESULT=$(node "$DIR/../src/assert-tag.js" "$1" "$2")
6
6
  if [ "$RESULT" != "true" ]; then
7
- echo "Invalid semver: $1"
7
+ echo "Invalid tag: $2"
8
8
  exit 1
9
9
  fi
@@ -8,12 +8,6 @@ if [ ! -f "$JSON" ]; then
8
8
  else
9
9
  npm --prefix "$PACKAGE" ci --silent
10
10
  fi
11
- if jq -e '.scripts.lint' "$JSON" >/dev/null 2>&1; then
12
- npm --prefix "$PACKAGE" run lint --silent
13
- fi
14
- if jq -e '.scripts.test' "$JSON" >/dev/null 2>&1; then
15
- npm --prefix "$PACKAGE" run test --silent
16
- fi
17
11
  if jq -e '.scripts.build' "$JSON" >/dev/null 2>&1; then
18
12
  npm --prefix "$PACKAGE" run build --silent
19
13
  fi
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+ SCRIPT="$(realpath "$0")"
4
+ DIR="$(dirname "$SCRIPT")"
5
+ RESULT=$(node "$DIR/../src/put-version.js" "$1")
6
+ echo "version=$RESULT" >> "$GITHUB_OUTPUT"
package/package.json CHANGED
@@ -5,7 +5,8 @@
5
5
  "arctool-build": "bin/arctool-build.sh",
6
6
  "arctool-put-deploy-dir": "bin/arctool-put-deploy-dir.sh",
7
7
  "arctool-put-prerelease": "bin/arctool-put-prerelease.sh",
8
- "arctool-put-skip-build": "bin/arctool-put-skip-build.sh"
8
+ "arctool-put-skip-build": "bin/arctool-put-skip-build.sh",
9
+ "arctool-put-version": "bin/arctool-put-version.sh"
9
10
  },
10
11
  "dependencies": {
11
12
  "semver": "^7.7.3"
@@ -16,5 +17,5 @@
16
17
  },
17
18
  "license": "Apache-2.0",
18
19
  "name": "@arcadible/github-release-tools",
19
- "version": "0.1.0"
20
+ "version": "0.1.2"
20
21
  }
package/src/assert-dir.js CHANGED
@@ -10,7 +10,7 @@ const existsSync = fs.existsSync; // eslint-disable-line no-sync
10
10
 
11
11
  // [define]
12
12
 
13
- const tag = process.argv[2];
13
+ const dir = process.argv[2];
14
14
 
15
15
  // [function]
16
16
 
@@ -18,13 +18,13 @@ const write = function (data) {
18
18
  process.stdout.write(data.trim().concat("\n"));
19
19
  };
20
20
 
21
- // [start]
21
+ // [main]
22
22
 
23
23
  try {
24
- if (!tag) {
25
- throw new Error("No tag provided.");
24
+ if (!dir) {
25
+ throw new Error("No dir provided.");
26
26
  }
27
- write(existsSync(tag) ? "true" : "false");
27
+ write(existsSync(dir) ? "true" : "false");
28
28
  } catch {
29
29
  write("false");
30
30
  }
package/src/assert-tag.js CHANGED
@@ -2,15 +2,18 @@
2
2
 
3
3
  // [import]
4
4
 
5
+ const fs = require("fs");
5
6
  const semver = require("semver");
6
7
 
7
8
  // [use]
8
9
 
10
+ const readFileSync = fs.readFileSync; // eslint-disable-line no-sync
9
11
  const valid = semver.valid;
10
12
 
11
13
  // [define]
12
14
 
13
- const tag = process.argv[2];
15
+ const file = process.argv[2];
16
+ const tag = process.argv[3];
14
17
 
15
18
  // [function]
16
19
 
@@ -18,13 +21,22 @@ const write = function (data) {
18
21
  process.stdout.write(data.trim().concat("\n"));
19
22
  };
20
23
 
21
- // [start]
24
+ // [main]
22
25
 
23
26
  try {
27
+ if (!file) {
28
+ throw new Error("No file provided.");
29
+ }
24
30
  if (!tag) {
25
31
  throw new Error("No tag provided.");
26
32
  }
27
- write(valid(tag) ? "true" : "false");
33
+ if (!tag.startsWith("arcadible/")) {
34
+ throw new Error("Invalid tag prefix.");
35
+ }
36
+ const buf = readFileSync(file, "utf8");
37
+ const conf = JSON.parse(buf);
38
+ const version = conf?.game?.version;
39
+ write(valid(version) && version === tag.split("/").pop() ? "true" : "false");
28
40
  } catch {
29
41
  write("false");
30
42
  }
@@ -21,10 +21,10 @@ const write = function (data) {
21
21
  // [function]
22
22
 
23
23
  const writeErr = function (data) {
24
- process.stdout.write(data.trim().concat("\n"));
24
+ process.stderr.write(data.trim().concat("\n"));
25
25
  };
26
26
 
27
- // [start]
27
+ // [main]
28
28
 
29
29
  try {
30
30
  if (!file) {
@@ -32,11 +32,7 @@ try {
32
32
  }
33
33
  const buf = readFileSync(file, "utf8");
34
34
  const conf = JSON.parse(buf);
35
- if (conf && typeof conf === "object" && conf.workflow) {
36
- write(conf.workflow.deploy_dir);
37
- } else {
38
- write("build");
39
- }
35
+ write(conf?.workflow?.deploy_dir || ".arcadible-public");
40
36
  } catch (ex) {
41
37
  writeErr(ex.message);
42
38
  process.exit(1);
@@ -2,16 +2,18 @@
2
2
 
3
3
  // [import]
4
4
 
5
+ const fs = require("fs");
5
6
  const semver = require("semver");
6
7
 
7
8
  // [use]
8
9
 
9
10
  const prerelease = semver.prerelease;
11
+ const readFileSync = fs.readFileSync; // eslint-disable-line no-sync
10
12
  const valid = semver.valid;
11
13
 
12
14
  // [define]
13
15
 
14
- const tag = process.argv[2];
16
+ const file = process.argv[2];
15
17
 
16
18
  // [function]
17
19
 
@@ -22,16 +24,19 @@ const write = function (data) {
22
24
  // [function]
23
25
 
24
26
  const writeErr = function (data) {
25
- process.stdout.write(data.trim().concat("\n"));
27
+ process.stderr.write(data.trim().concat("\n"));
26
28
  };
27
29
 
28
- // [start]
30
+ // [main]
29
31
 
30
32
  try {
31
- if (!tag) {
32
- throw new Error("No tag provided.");
33
+ if (!file) {
34
+ throw new Error("No file provided.");
33
35
  }
34
- write(valid(tag) && prerelease(tag) ? "true" : "false");
36
+ const buf = readFileSync(file, "utf8");
37
+ const conf = JSON.parse(buf);
38
+ const version = conf?.game?.version;
39
+ write(valid(version) && prerelease(version) ? "true" : "false");
35
40
  } catch (ex) {
36
41
  writeErr(ex.message);
37
42
  process.exit(1);
@@ -21,10 +21,10 @@ const write = function (data) {
21
21
  // [function]
22
22
 
23
23
  const writeErr = function (data) {
24
- process.stdout.write(data.trim().concat("\n"));
24
+ process.stderr.write(data.trim().concat("\n"));
25
25
  };
26
26
 
27
- // [start]
27
+ // [main]
28
28
 
29
29
  try {
30
30
  if (!file) {
@@ -32,11 +32,7 @@ try {
32
32
  }
33
33
  const buf = readFileSync(file, "utf8");
34
34
  const conf = JSON.parse(buf);
35
- if (conf && typeof conf === "object" && conf.workflow) {
36
- write(conf.workflow.skip_build ? "true" : "false");
37
- } else {
38
- write("false");
39
- }
35
+ write(conf?.workflow?.skip_build ? "true" : "false");
40
36
  } catch (ex) {
41
37
  writeErr(ex.message);
42
38
  process.exit(1);
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ // [import]
4
+
5
+ const fs = require("fs");
6
+ const semver = require("semver");
7
+
8
+ // [use]
9
+
10
+ const readFileSync = fs.readFileSync; // eslint-disable-line no-sync
11
+ const valid = semver.valid;
12
+
13
+ // [define]
14
+
15
+ const file = process.argv[2];
16
+
17
+ // [function]
18
+
19
+ const write = function (data) {
20
+ process.stdout.write(data.trim().concat("\n"));
21
+ };
22
+
23
+ // [function]
24
+
25
+ const writeErr = function (data) {
26
+ process.stderr.write(data.trim().concat("\n"));
27
+ };
28
+
29
+ // [main]
30
+
31
+ try {
32
+ if (!file) {
33
+ throw new Error("No file provided.");
34
+ }
35
+ const buf = readFileSync(file, "utf8");
36
+ const conf = JSON.parse(buf);
37
+ const version = conf?.game?.version;
38
+ if (!valid(version)) {
39
+ throw new Error("Invalid semver.");
40
+ }
41
+ write(version);
42
+ } catch (ex) {
43
+ writeErr(ex.message);
44
+ process.exit(1);
45
+ }
@@ -1,39 +0,0 @@
1
- {
2
- "lockfileVersion": 3,
3
- "name": "@arcadible/github-release-tools",
4
- "packages": {
5
- "": {
6
- "bin": {
7
- "arctool-assert-dir": "bin/arctool-assert-dir.sh",
8
- "arctool-assert-tag": "bin/arctool-assert-tag.sh",
9
- "arctool-build": "bin/arctool-build.sh",
10
- "arctool-put-deploy-dir": "bin/arctool-put-deploy-dir.sh",
11
- "arctool-put-prerelease": "bin/arctool-put-prerelease.sh",
12
- "arctool-put-skip-build": "bin/arctool-put-skip-build.sh"
13
- },
14
- "dependencies": {
15
- "semver": "^7.7.3"
16
- },
17
- "engines": {
18
- "node": ">=24.11.1"
19
- },
20
- "license": "Apache-2.0",
21
- "name": "@arcadible/github-release-tools",
22
- "version": "0.1.0"
23
- },
24
- "node_modules/semver": {
25
- "bin": {
26
- "semver": "bin/semver.js"
27
- },
28
- "engines": {
29
- "node": ">=10"
30
- },
31
- "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
32
- "license": "ISC",
33
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
34
- "version": "7.8.5"
35
- }
36
- },
37
- "requires": true,
38
- "version": "0.1.0"
39
- }