build-static-release.sh 774 字节
Newer Older
1 2 3 4 5
#!/usr/bin/env bash
set -euo pipefail

main() {
  cd "$(dirname "${0}")/../.."
6
  source ./ci/lib.sh
7 8 9 10 11 12 13 14 15 16 17 18 19 20

  rsync "$RELEASE_PATH/" "$RELEASE_PATH-static"
  RELEASE_PATH+=-static

  # We cannot find the path to node from $PATH because yarn shims a script to ensure
  # we use the same version it's using so we instead run a script with yarn that
  # will print the path to node.
  local node_path
  node_path="$(yarn -s node <<< 'console.info(process.execPath)')"

  mkdir -p "$RELEASE_PATH/bin"
  rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
  rsync "$node_path" "$RELEASE_PATH/lib/node"

21 22 23
  ln -s "./bin/code-server" "$RELEASE_PATH/code-server"
  ln -s "./lib/node" "$RELEASE_PATH/node"

24
  cd "$RELEASE_PATH"
25
  yarn --production --frozen-lockfile
26 27 28
}

main "$@"