Onset: version control where nobody waits and nothing gets lost. The on command, its core and onset-server.
| 6 | # Then: npm publish <tgz> --access public |
| 7 | set -euo pipefail |
| 8 | VERSION=$1 |
| 9 | CHANNEL=${2:-latest} |
| 10 | OUT=${3:-$PWD} |
| 11 | BASE=${ONSET_DOWNLOADS:-https://downloads.coline.dev/onset} |
| 12 | HERE=$(cd "$(dirname "$0")" && pwd) |
| 13 | DIR=$(mktemp -d) |
| 14 | trap 'rm -rf "$DIR"' EXIT |
| 15 | cp -R "$HERE/bin" "$HERE/package.json" "$HERE/README.md" "$DIR/" |
| 16 | cp "$HERE/../LICENSE-APACHE" "$DIR/LICENSE" |
| 17 | curl -fsSL "$BASE/$CHANNEL.json" -o "$DIR/manifest.json" |
| 18 | node -e ' |
| 19 | const fs = require("fs"); |
| 20 | const [dir, version] = process.argv.slice(1); |
| 21 | const m = JSON.parse(fs.readFileSync(dir + "/manifest.json", "utf8")); |
| 22 | if (m.version !== version) { console.error(`the channel has ${m.version}, not ${version}`); process.exit(1); } |
| 23 | for (const p of ["darwin-arm64", "darwin-x64", "linux-arm64", "linux-x64", "windows-x64", "windows-arm64"]) { |
| 24 | if (!m.platforms[p]) { console.error(`the release has no ${p} build`); process.exit(1); } |
| 25 | } |
| 26 | const pkg = JSON.parse(fs.readFileSync(dir + "/package.json", "utf8")); |
| 27 | pkg.version = version; |
| 28 | fs.writeFileSync(dir + "/package.json", JSON.stringify(pkg, null, 2) + "\n"); |
| 29 | ' "$DIR" "$VERSION" |
| 30 | mkdir -p "$OUT" |
| 31 | (cd "$DIR" && npm pack --silent --pack-destination "$OUT" >/dev/null 2>&1) |
| 32 | echo "$OUT/colineapp-onset-$VERSION.tgz" |
| 33 |