diff --git a/README-ADMINS.md b/README-ADMINS.md index 84d90c0..c8112a3 100644 --- a/README-ADMINS.md +++ b/README-ADMINS.md @@ -59,13 +59,16 @@ Try `speedscope sample/profiles/stackcollapse/simple.txt`, which should immediat ## Deploying the website +This step must follow the "Publish to npm" step, since it uses assets from +the npm publish. + https://www.speedscope.app/ is hosted on GitHub pages, and is published via pushing to the `gh-pages` branch. The `gh-pages` branch has totally different contents than other branches of this repository: https://github.com/jlfwong/speedscope/tree/gh-pages. -It's populated by a deploy script which is invoked by running `npm run deploy` script. -This will do a build of the static resources, and boot a local server for you to test -the compiled assets. Please do not skip the manual testing in this step. +It's populated by a deploy script which is invoked by running `npm run deploy` script. This populate a directory with assets pulled from npm, and +boot a local server for you to test the compiled assets. Please do not skip +the manual testing in this step. If everything looks good, you should be able to hit Ctrl+C, and you should see this prompt: @@ -80,8 +83,10 @@ which includes the version, the date, and the commit of the deploy. ## Upload a release to GitHub -To make a zipfile suitable for uploading to GitHub as a release, run `scripts/prepare-zip-file.sh`. Note that this step must follow the "Publish to npm" step, -since it uses assets from the npm publish. +This step must follow the "Publish to npm" step, since it uses assets from +the npm publish. + +To make a zipfile suitable for uploading to GitHub as a release, run `scripts/prepare-zip-file.sh`. Once that's done, you should have a zip file in `dist/release/` diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 535310b..f5721f0 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -1,26 +1,28 @@ #!/bin/bash # -# type check, do a release build, then do a shallow clone of the -# repository into a temporary directory and copy the release build -# artifacts into there to commit & push to the gh-pages branch +# Do a shallow clone of the repository into a temporary directory and copy the +# artifacts pulled from npm into the shallow clone to commit & push to the +# gh-pages branch. set -euxo pipefail -OUTDIR=`pwd`/dist/release -echo $OUTDIR +SRCDIR=`pwd` +OUTDIR=`mktemp -d -t speedscope-unpacked` -./scripts/build-release.sh +# Untar the package +pushd "$OUTDIR" +PACKEDNAME=`npm pack speedscope | tail -n1` +tar -xvvf "$PACKEDNAME" # Create a shallow clone of the repository -TMPDIR=`mktemp -d -t speedscope-release` -echo "Entering $TMPDIR" +TMPDIR=`mktemp -d -t speedscope-deploy` pushd "$TMPDIR" git clone --depth 1 git@github.com:jlfwong/speedscope.git -b gh-pages # Copy the build artifacts into the shallow clone pushd speedscope rm -rf * -cp -R "$OUTDIR"/* . +cp -R "$OUTDIR"/package/dist/release/** . # Set the CNAME record echo www.speedscope.app > CNAME @@ -35,17 +37,14 @@ function ctrl_c() { if [[ $REPLY =~ ^yes$ ]] then git add --all - git commit -m 'Release' + git commit -m "Deploy $PACKEDNAME" git push origin HEAD:gh-pages - popd rm -rf "$TMPDIR" exit 0 else set +x echo "Aborting release." set -x - - popd rm -rf "$TMPDIR" exit 1 fi diff --git a/scripts/prepare-zip-file.sh b/scripts/prepare-zip-file.sh index 24f6c3a..2746296 100755 --- a/scripts/prepare-zip-file.sh +++ b/scripts/prepare-zip-file.sh @@ -1,7 +1,7 @@ #!/bin/bash -# Prepare a mock installation of speedscope to test it before the actual npm -# publish +# Create a zip file containing a standalone copy of speedscope +# based on the contents of the package published to npm set -euxo pipefail