mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-02 12:57:32 -06:00
* Use webpack to autogenerate the files. That way, we always generate them consistently, be it through `make` or building for prod. This fixes the `make` issue, and also means we've further unified the way we build and run with `make` vs prod. Unfortunately this doesn't work for `make dev`; which sees the handlebars content only. That's probably ok though, I think.
59 lines
1.5 KiB
Bash
Executable File
59 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT="$(
|
|
cd -- "$(dirname "$0")/../.." >/dev/null 2>&1
|
|
pwd -P
|
|
)"
|
|
cd "$ROOT"
|
|
|
|
RELEASE_FILE_NAME=${GITHUB_RUN_NUMBER}
|
|
RELEASE_NAME=gh-${RELEASE_FILE_NAME}
|
|
HASH=$(git rev-parse HEAD)
|
|
|
|
# Clear the output
|
|
rm -rf out
|
|
mkdir -p out/dist
|
|
cd out/dist
|
|
|
|
echo "${HASH}" >git_hash
|
|
echo "${RELEASE_NAME}" >release_build
|
|
|
|
cp -R "${ROOT}"/etc \
|
|
"${ROOT}"/examples \
|
|
"${ROOT}"/views \
|
|
"${ROOT}"/types \
|
|
"${ROOT}"/package*.json \
|
|
.
|
|
rm -rf "${ROOT}"/lib/storage/data
|
|
|
|
# Set up and build and webpack everything
|
|
cd "${ROOT}"
|
|
npm install --no-audit
|
|
npm run webpack
|
|
npm run ts-compile
|
|
|
|
# Now install only the production dependencies in our output directory
|
|
cd out/dist
|
|
npm install --no-audit --ignore-scripts --production
|
|
rm -rf node_modules/.cache/ node_modules/monaco-editor/
|
|
find node_modules -name \*.ts -delete
|
|
|
|
# Output some magic for GH to set the branch name and release name
|
|
echo "::set-output name=branch::${GITHUB_REF#refs/heads/}"
|
|
echo "::set-output name=release_name::${RELEASE_NAME}"
|
|
|
|
# Run to make sure we haven't just made something that won't work
|
|
node -r esm ./app.js --version --dist
|
|
|
|
rm -rf "${ROOT}/out/dist-bin"
|
|
mkdir -p "${ROOT}/out/dist-bin"
|
|
export XZ_OPT="-1 -T 0"
|
|
tar -Jcf "${ROOT}/out/dist-bin/${RELEASE_FILE_NAME}.tar.xz" .
|
|
pushd "${ROOT}/out/webpack"
|
|
tar -Jcf "${ROOT}/out/dist-bin/${RELEASE_FILE_NAME}.static.tar.xz" --transform="s,^static/,," static/*
|
|
popd
|
|
echo "${HASH}" >"${ROOT}/out/dist-bin/${RELEASE_FILE_NAME}.txt"
|
|
du -ch ./*
|