From 45448f549fd36808fd5e2fcb7acee05558f28b94 Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Wed, 17 Apr 2019 22:46:08 -0500 Subject: [PATCH 1/5] misc: add releasing scripts --- docs/releasing.md | 86 ++++--------------- .../scripts/publish-prepare-commit.sh | 69 +++++++++++++++ .../scripts/publish-prepare-package.sh | 47 ++++++++++ .../scripts/publish-prepare-pristine.sh | 23 +++++ lighthouse-core/scripts/publish-test.sh | 51 +++++++++++ 5 files changed, 206 insertions(+), 70 deletions(-) create mode 100755 lighthouse-core/scripts/publish-prepare-commit.sh create mode 100755 lighthouse-core/scripts/publish-prepare-package.sh create mode 100755 lighthouse-core/scripts/publish-prepare-pristine.sh create mode 100755 lighthouse-core/scripts/publish-test.sh diff --git a/docs/releasing.md b/docs/releasing.md index f61541bde26a..6d2030555479 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -31,71 +31,20 @@ We follow [semver](https://semver.org/) versioning semantics (`vMajor.Minor.Patc ## Release Process ```sh -# use a custom lighthouse-pristine checkout to make sure your dev files aren't involved. - -# * Install the latest.* -yarn - -# * Bump it * -yarn version --no-git-tag-version -# manually bump extension v in clients/extension/manifest.json -yarn update:sample-json - -# * Build it. This also builds the cli, extension, and viewer. * -yarn build-all - -# * Test err'thing * -echo "Test the CLI." -yarn start "https://example.com" --view -yarn smoke - -echo "Test the extension" -# ... - -echo "Test a fresh local install" -# (starting from lighthouse-pristine root...) -npm pack -cd ..; rm -rf tmp; mkdir tmp; cd tmp -npm init -y -npm install ../lighthouse-pristine/lighthouse-*.tgz -npm explore lighthouse -- npm run smoke -npm explore lighthouse -- npm run chrome # try the manual launcher -npm explore lighthouse -- npm run fast -- http://example.com -cd ..; rm -rf ./tmp; - -cd ../lighthouse-pristine; command rm -f lighthouse-*.tgz - -echo "Test the lighthouse-viewer build" -# Manual test for now: -# Start a server in dist/viewer/ and open the page in a tab. You should see the viewer. -# Drop in a results.json or paste an existing gist url (e.g. https://gist.github.com/ebidel/b9fd478b5f40bf5fab174439dc18f83a). -# Check for errors! -cd dist/viewer ; python -m SimpleHTTPServer -# go to http://localhost:8000/ - -# * Update changelog * -git fetch --tags -yarn changelog -# add new contributors, e.g. from git shortlog -s -e -n v2.3.0..HEAD -# and https://github.com/GoogleChrome/lighthouse/graphs/contributors -echo "Edit the changelog for readability and brevity" - -# * Put up the PR * -echo "Branch and commit the version bump." -git checkout -b bumpv240 -git commit -am "2.4.0" -echo "Generate a PR and get it merged." - -echo "Once it's merged, pull master and tag the (squashed) commit" -git tag -a v2.4.0 -m "v2.4.0" -git push --tags - - -# * Deploy-time * -echo "Rebuild extension and viewer to get the latest, tagged master commit" -yarn build-all; - -# zip the extension files +# Run the tests +bash ./lighthouse-core/scripts/publish-test.sh +# Prepare the commit +bash ./lighthouse-core/scripts/publish-prepare-commit.sh + +# Open the PR and await merge... +echo "It's been merged! 🎉" + +# Run the tests again :) +bash ./lighthouse-core/scripts/publish-test.sh +# Package everything for publishing +bash ./lighthouse-core/scripts/publish-prepare-package.sh + +# Upload the extension node build/build-extension.js package; cd dist/extension-package/ echo "Go here: https://chrome.google.com/webstore/developer/edit/blipmdconlkpinefehnmjammfjpmpbjk " echo "Upload the package zip to CWS dev dashboard" @@ -106,12 +55,9 @@ echo "Upload the package zip to CWS dev dashboard" # Select `lighthouse-4.X.X.zip` # _Publish_ at the bottom -echo "Verify the npm package won't include unncessary files" -npm pack --dry-run -npx pkgfiles - -echo "ship it" +# Publish to NPM npm publish +# Publish viewer yarn deploy-viewer # * Tell the world!!! * diff --git a/lighthouse-core/scripts/publish-prepare-commit.sh b/lighthouse-core/scripts/publish-prepare-commit.sh new file mode 100755 index 000000000000..ded8c608410a --- /dev/null +++ b/lighthouse-core/scripts/publish-prepare-commit.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +TXT_BOLD=$(tput bold) +TXT_DIM=$(tput setaf 245) +TXT_RESET=$(tput sgr0) + +DIRNAME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +LH_ROOT="$DIRNAME/../.." +cd $LH_ROOT + +set -euxo pipefail + +OLD_VERSION=$(node -e "console.log(require('./package.json').version)") +NEW_VERSION=$1 +BRANCH_NAME="bump_$NEW_VERSION" +SEMVER_PATTERN="[0-9]*\.[0-9]*\.[0-9]*" + +if [[ $(echo $NEW_VERSION | sed 's/[0-9]*\.[0-9]*\.[0-9]*/SECRET_REPLACE/g') != "SECRET_REPLACE" ]]; then + echo "Incorrect version format. Must be x.x.x" + exit 1 +fi + +if [[ -n "$(git status --porcelain)" ]]; then + echo "Pristine repo has changes to the files! Commit or stash the changes to continue." + exit 1 +fi + +# Checkout a new branch for the version commit +git fetch origin master +git checkout origin/master +git branch -D "$BRANCH_NAME" || true +git checkout -b "$BRANCH_NAME" + +# Install the dependencies. +yarn install + +# Bump the version in package.json and clients/extension/manifest.json +NEEDLE="^ \"version\": \"$SEMVER_PATTERN\"" +REPLACEMENT=" \"version\": \"$NEW_VERSION\"" + +sed -i '' "s/$NEEDLE/$REPLACEMENT/g" package.json clients/extension/manifest.json + +# Update the fixtures with the new version +yarn update:sample-json + +# Create the changelog entry +yarn changelog + +# Add new contributors to changelog +OLD_VERSION=$(node -e "console.log(require('./package.json').version)") +git --no-pager shortlog -s -e -n "v2.3.0..v${OLD_VERSION}" | cut -f 2 | sort > auto_contribs_prior_to_last +git --no-pager shortlog -s -e -n "v${OLD_VERSION}..HEAD" | cut -f 2 | sort > auto_contribs_since_last +NEW_CONTRIBUTORS=$(comm -13 auto_contribs_prior_to_last auto_contribs_since_last) +rm auto_contribs_prior_to_last auto_contribs_since_last + +if [[ $(echo "$NEW_CONTRIBUTORS" | wc -l) -gt 1 ]]; then + echo "Thanks to our new contributors 👽🐷🐰🐯🐻! \n$NEW_CONTRIBUTORS\n" | cat - changelog.md > tmp-changelog + mv tmp-changelog changelog.md +fi + +git add changelog.md lighthouse-core/test/results/ proto/ +git commit -m "$NEW_VERSION" + +echo "Version bump commit ready on the ${TXT_BOLD}$BRANCH_NAME${TXT_RESET} branch!" + +read -n 1 -p "${TXT_DIM}Press any key to see the git diff, CTRL+C to exit...${TXT_RESET}" unused_variable +git --no-pager diff HEAD^ +read -n 1 -p "${TXT_DIM}Press any key to push to GitHub, CTRL+C to exit...${TXT_RESET}" unused_variable +git push -u origin "$BRANCH_NAME" diff --git a/lighthouse-core/scripts/publish-prepare-package.sh b/lighthouse-core/scripts/publish-prepare-package.sh new file mode 100755 index 000000000000..d0c2cac98cc5 --- /dev/null +++ b/lighthouse-core/scripts/publish-prepare-package.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +TXT_BOLD=$(tput bold) +TXT_DIM=$(tput setaf 245) +TXT_RESET=$(tput sgr0) + +DIRNAME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +LH_PRISTINE_ROOT="$DIRNAME/../../../lighthouse-pristine" + +set -euxo pipefail + +bash "$DIRNAME/publish-prepare-pristine.sh" + +cd "$LH_PRISTINE_ROOT" + +VERSION=$(node -e "console.log(require('./package.json').version)") + +if ! git rev-parse "v$VERSION" ; then + if ! git --no-pager log -n 1 --oneline | grep "v$VERSION" ; then + echo "Cannot tag a commit other than the version bump!"; + exit 1; + fi + + git tag -a "v$VERSION" -m "v$VERSION" +fi + + +if [[ $(git rev-parse "v$VERSION") != $(git rev-parse HEAD )]]; then + echo "Cannot package a version other than the tagged version!"; + exit 1; +fi + +# Install the dependencies. +yarn install + +# Build everything +yarn build-all + +# Package the extension +node build/build-extension.js package + +# Verify the npm package won't include unncessary files +npm pack --dry-run +npx pkgfiles + +echo "Make sure the files above look good!" + diff --git a/lighthouse-core/scripts/publish-prepare-pristine.sh b/lighthouse-core/scripts/publish-prepare-pristine.sh new file mode 100755 index 000000000000..f261ff9940f9 --- /dev/null +++ b/lighthouse-core/scripts/publish-prepare-pristine.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +DIRNAME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +LH_ROOT="$DIRNAME/../.." +cd $LH_ROOT + +set -euxo pipefail + +# Setup a pristine git environment +cd ../ +git clone git@github.com:GoogleChrome/lighthouse.git lighthouse-pristine +cd lighthouse-pristine/ + +if [[ -n "$(git status --porcelain)" ]]; then + echo "Pristine repo has changes to the files! Commit or stash the changes to continue." + exit 1 +fi + +git fetch origin +git fetch --tags +git checkout -f master +git reset --hard origin/master +git clean -fx diff --git a/lighthouse-core/scripts/publish-test.sh b/lighthouse-core/scripts/publish-test.sh new file mode 100755 index 000000000000..e168bb21c548 --- /dev/null +++ b/lighthouse-core/scripts/publish-test.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +TXT_BOLD=$(tput bold) +TXT_DIM=$(tput setaf 245) +TXT_RESET=$(tput sgr0) + +DIRNAME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +LH_PRISTINE_ROOT="$DIRNAME/../../../lighthouse-pristine" + +set -euxo pipefail + +bash "$DIRNAME/publish-prepare-pristine.sh" + +cd "$LH_PRISTINE_ROOT" + +# Test err'thing +echo "${TXT_BOLD}Building all the clients..." +yarn build-all + +echo "Running the standard test suite..." +yarn test + +echo "Running the smoke tests...." +yarn smoke + +echo "Testing the CLI..." +yarn start "https://example.com" --view + +echo "Testing a fresh local install..." +npm pack + +rm -rf /tmp/lighthouse-local-test || true +mkdir -p /tmp/lighthouse-local-test +cd /tmp/lighthouse-local-test + +npm init -y +npm install "$LH_PRISTINE_ROOT/lighthouse-*.tgz" +npm explore lighthouse -- npm run smoke +npm explore lighthouse -- npm run chrome # try the manual launcher +npm explore lighthouse -- npm run fast -- http://example.com + +cd "$LH_PRISTINE_ROOT" +rm -rf /tmp/lighthouse-local-test +rm lighthouse-*.tgz + +echo "${TXT_BOLD}Now manually...${TXT_RESET}" +echo "✅ Test the extension. Open chrome://extensions" +read -n 1 -p "${TXT_DIM}Press any key to continue...${TXT_RESET}" unused_variable +echo "✅ Test the viewer. Open http://localhost:8000" +echo " - Works with v4 report? https://gist.github.com/patrickhulce/7251f9eba409f385e4c0424515fe8009" +read -n 1 -p "${TXT_DIM}Press any key to continue...${TXT_RESET}" unused_variable From 019b8fa24444888a249fb6976ef23a9572b3e6d7 Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Thu, 18 Apr 2019 10:20:26 -0500 Subject: [PATCH 2/5] fixes --- .../scripts/publish-clean-pristine.sh | 17 +++++++++++++++++ .../scripts/publish-prepare-pristine.sh | 6 +++++- lighthouse-core/scripts/publish-test.sh | 16 ++++++++++++---- 3 files changed, 34 insertions(+), 5 deletions(-) create mode 100755 lighthouse-core/scripts/publish-clean-pristine.sh diff --git a/lighthouse-core/scripts/publish-clean-pristine.sh b/lighthouse-core/scripts/publish-clean-pristine.sh new file mode 100755 index 000000000000..eb13a44216ae --- /dev/null +++ b/lighthouse-core/scripts/publish-clean-pristine.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +DIRNAME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +LH_ROOT="$DIRNAME/../.." +cd $LH_ROOT + +set -euxo pipefail + +# Setup a pristine git environment +cd ../lighthouse-pristine + +if [[ -z "$(git status --porcelain)" ]]; then + echo "Pristine repo already clean!" + exit 0 +fi + +git clean -fx diff --git a/lighthouse-core/scripts/publish-prepare-pristine.sh b/lighthouse-core/scripts/publish-prepare-pristine.sh index f261ff9940f9..2b79674ced0e 100755 --- a/lighthouse-core/scripts/publish-prepare-pristine.sh +++ b/lighthouse-core/scripts/publish-prepare-pristine.sh @@ -8,7 +8,11 @@ set -euxo pipefail # Setup a pristine git environment cd ../ -git clone git@github.com:GoogleChrome/lighthouse.git lighthouse-pristine + +if [[ ! -e lighthouse-pristine/ ]]; then + git clone git@github.com:GoogleChrome/lighthouse.git lighthouse-pristine +fi + cd lighthouse-pristine/ if [[ -n "$(git status --porcelain)" ]]; then diff --git a/lighthouse-core/scripts/publish-test.sh b/lighthouse-core/scripts/publish-test.sh index e168bb21c548..e6dc1508627f 100755 --- a/lighthouse-core/scripts/publish-test.sh +++ b/lighthouse-core/scripts/publish-test.sh @@ -13,6 +13,9 @@ bash "$DIRNAME/publish-prepare-pristine.sh" cd "$LH_PRISTINE_ROOT" +# Install deps +yarn --check-files + # Test err'thing echo "${TXT_BOLD}Building all the clients..." yarn build-all @@ -27,6 +30,7 @@ echo "Testing the CLI..." yarn start "https://example.com" --view echo "Testing a fresh local install..." +VERSION=$(node -e "console.log(require('./package.json').version)") npm pack rm -rf /tmp/lighthouse-local-test || true @@ -34,18 +38,22 @@ mkdir -p /tmp/lighthouse-local-test cd /tmp/lighthouse-local-test npm init -y -npm install "$LH_PRISTINE_ROOT/lighthouse-*.tgz" +npm install "$LH_PRISTINE_ROOT/lighthouse-$VERSION.tgz" npm explore lighthouse -- npm run smoke npm explore lighthouse -- npm run chrome # try the manual launcher npm explore lighthouse -- npm run fast -- http://example.com cd "$LH_PRISTINE_ROOT" rm -rf /tmp/lighthouse-local-test -rm lighthouse-*.tgz +rm "lighthouse-$VERSION.tgz" echo "${TXT_BOLD}Now manually...${TXT_RESET}" echo "✅ Test the extension. Open chrome://extensions" -read -n 1 -p "${TXT_DIM}Press any key to continue...${TXT_RESET}" unused_variable +echo "${TXT_DIM}Press any key to continue...${TXT_RESET}" +read -n 1 -r unused_variable + + echo "✅ Test the viewer. Open http://localhost:8000" echo " - Works with v4 report? https://gist.github.com/patrickhulce/7251f9eba409f385e4c0424515fe8009" -read -n 1 -p "${TXT_DIM}Press any key to continue...${TXT_RESET}" unused_variable +echo "${TXT_DIM}Press any key to complete the test script...${TXT_RESET}" +read -n 1 -r unused_variable From e242b3b469d85f032deec1f8a7a0df0a124ba960 Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Thu, 18 Apr 2019 10:22:35 -0500 Subject: [PATCH 3/5] commit fixes --- .../scripts/publish-prepare-commit.sh | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lighthouse-core/scripts/publish-prepare-commit.sh b/lighthouse-core/scripts/publish-prepare-commit.sh index ded8c608410a..79c52495be2f 100755 --- a/lighthouse-core/scripts/publish-prepare-commit.sh +++ b/lighthouse-core/scripts/publish-prepare-commit.sh @@ -6,22 +6,27 @@ TXT_RESET=$(tput sgr0) DIRNAME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" LH_ROOT="$DIRNAME/../.." -cd $LH_ROOT +cd "$LH_ROOT" set -euxo pipefail +if [[ "$#" -ne 1 ]]; then + echo "You must specify the version to prepare a commit for!" + exit 1 +fi + OLD_VERSION=$(node -e "console.log(require('./package.json').version)") NEW_VERSION=$1 BRANCH_NAME="bump_$NEW_VERSION" SEMVER_PATTERN="[0-9]*\.[0-9]*\.[0-9]*" -if [[ $(echo $NEW_VERSION | sed 's/[0-9]*\.[0-9]*\.[0-9]*/SECRET_REPLACE/g') != "SECRET_REPLACE" ]]; then +if [[ $(echo "$NEW_VERSION" | sed 's/[0-9]*\.[0-9]*\.[0-9]*/SECRET_REPLACE/g') != "SECRET_REPLACE" ]]; then echo "Incorrect version format. Must be x.x.x" exit 1 fi if [[ -n "$(git status --porcelain)" ]]; then - echo "Pristine repo has changes to the files! Commit or stash the changes to continue." + echo "Repo has changes to the files! Commit or stash the changes to continue." exit 1 fi @@ -47,14 +52,13 @@ yarn update:sample-json yarn changelog # Add new contributors to changelog -OLD_VERSION=$(node -e "console.log(require('./package.json').version)") git --no-pager shortlog -s -e -n "v2.3.0..v${OLD_VERSION}" | cut -f 2 | sort > auto_contribs_prior_to_last git --no-pager shortlog -s -e -n "v${OLD_VERSION}..HEAD" | cut -f 2 | sort > auto_contribs_since_last NEW_CONTRIBUTORS=$(comm -13 auto_contribs_prior_to_last auto_contribs_since_last) rm auto_contribs_prior_to_last auto_contribs_since_last if [[ $(echo "$NEW_CONTRIBUTORS" | wc -l) -gt 1 ]]; then - echo "Thanks to our new contributors 👽🐷🐰🐯🐻! \n$NEW_CONTRIBUTORS\n" | cat - changelog.md > tmp-changelog + printf "Thanks to our new contributors 👽🐷🐰🐯🐻! \n$NEW_CONTRIBUTORS\n" | cat - changelog.md > tmp-changelog mv tmp-changelog changelog.md fi @@ -63,7 +67,9 @@ git commit -m "$NEW_VERSION" echo "Version bump commit ready on the ${TXT_BOLD}$BRANCH_NAME${TXT_RESET} branch!" -read -n 1 -p "${TXT_DIM}Press any key to see the git diff, CTRL+C to exit...${TXT_RESET}" unused_variable +echo "${TXT_DIM}Press any key to see the git diff, CTRL+C to exit...${TXT_RESET}" +read -n 1 -r unused_variable git --no-pager diff HEAD^ -read -n 1 -p "${TXT_DIM}Press any key to push to GitHub, CTRL+C to exit...${TXT_RESET}" unused_variable +echo "${TXT_DIM}Press any key to push to GitHub, CTRL+C to exit...${TXT_RESET}" +read -n 1 -r unused_variable git push -u origin "$BRANCH_NAME" From a19edf76b4befbe7a2219134d737dd1afba1fd80 Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Thu, 18 Apr 2019 10:30:00 -0500 Subject: [PATCH 4/5] package fixes --- lighthouse-core/scripts/publish-prepare-package.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lighthouse-core/scripts/publish-prepare-package.sh b/lighthouse-core/scripts/publish-prepare-package.sh index d0c2cac98cc5..4ffd084100a6 100755 --- a/lighthouse-core/scripts/publish-prepare-package.sh +++ b/lighthouse-core/scripts/publish-prepare-package.sh @@ -1,9 +1,5 @@ #!/usr/bin/env bash -TXT_BOLD=$(tput bold) -TXT_DIM=$(tput setaf 245) -TXT_RESET=$(tput sgr0) - DIRNAME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" LH_PRISTINE_ROOT="$DIRNAME/../../../lighthouse-pristine" @@ -24,11 +20,7 @@ if ! git rev-parse "v$VERSION" ; then git tag -a "v$VERSION" -m "v$VERSION" fi - -if [[ $(git rev-parse "v$VERSION") != $(git rev-parse HEAD )]]; then - echo "Cannot package a version other than the tagged version!"; - exit 1; -fi +git checkout -f "v$VERSION" # Install the dependencies. yarn install From feda461547cf1129efc79987b83e92c079e53bdd Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Mon, 22 Apr 2019 22:55:20 -0500 Subject: [PATCH 5/5] feedback --- docs/releasing.md | 14 ++++++++------ .../{ => release}/publish-clean-pristine.sh | 2 +- .../{ => release}/publish-prepare-commit.sh | 3 ++- .../{ => release}/publish-prepare-package.sh | 4 ++-- .../{ => release}/publish-prepare-pristine.sh | 4 ++-- .../scripts/{ => release}/publish-test.sh | 4 ++-- 6 files changed, 17 insertions(+), 14 deletions(-) rename lighthouse-core/scripts/{ => release}/publish-clean-pristine.sh (91%) rename lighthouse-core/scripts/{ => release}/publish-prepare-commit.sh (98%) rename lighthouse-core/scripts/{ => release}/publish-prepare-package.sh (87%) rename lighthouse-core/scripts/{ => release}/publish-prepare-pristine.sh (80%) rename lighthouse-core/scripts/{ => release}/publish-test.sh (93%) diff --git a/docs/releasing.md b/docs/releasing.md index 6d2030555479..a1a026f0ec85 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -32,21 +32,21 @@ We follow [semver](https://semver.org/) versioning semantics (`vMajor.Minor.Patc ```sh # Run the tests -bash ./lighthouse-core/scripts/publish-test.sh -# Prepare the commit -bash ./lighthouse-core/scripts/publish-prepare-commit.sh +bash ./lighthouse-core/scripts/release/release-test.sh +# Prepare the commit, replace x.x.x with the desired version +bash ./lighthouse-core/scripts/release/release-prepare-commit.sh x.x.x # Open the PR and await merge... echo "It's been merged! 🎉" # Run the tests again :) -bash ./lighthouse-core/scripts/publish-test.sh +bash ./lighthouse-core/scripts/release/release-test.sh # Package everything for publishing -bash ./lighthouse-core/scripts/publish-prepare-package.sh +bash ./lighthouse-core/scripts/release/release-prepare-package.sh # Upload the extension node build/build-extension.js package; cd dist/extension-package/ -echo "Go here: https://chrome.google.com/webstore/developer/edit/blipmdconlkpinefehnmjammfjpmpbjk " +open https://chrome.google.com/webstore/developer/edit/blipmdconlkpinefehnmjammfjpmpbjk echo "Upload the package zip to CWS dev dashboard" # Be in lighthouse-extension-owners group # Open @@ -55,6 +55,8 @@ echo "Upload the package zip to CWS dev dashboard" # Select `lighthouse-4.X.X.zip` # _Publish_ at the bottom +# Make sure you're in the Lighthouse pristine repo we just tested. +cd ../lighthouse-pristine # Publish to NPM npm publish # Publish viewer diff --git a/lighthouse-core/scripts/publish-clean-pristine.sh b/lighthouse-core/scripts/release/publish-clean-pristine.sh similarity index 91% rename from lighthouse-core/scripts/publish-clean-pristine.sh rename to lighthouse-core/scripts/release/publish-clean-pristine.sh index eb13a44216ae..f4bf04a26e3a 100755 --- a/lighthouse-core/scripts/publish-clean-pristine.sh +++ b/lighthouse-core/scripts/release/publish-clean-pristine.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash DIRNAME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -LH_ROOT="$DIRNAME/../.." +LH_ROOT="$DIRNAME/../../.." cd $LH_ROOT set -euxo pipefail diff --git a/lighthouse-core/scripts/publish-prepare-commit.sh b/lighthouse-core/scripts/release/publish-prepare-commit.sh similarity index 98% rename from lighthouse-core/scripts/publish-prepare-commit.sh rename to lighthouse-core/scripts/release/publish-prepare-commit.sh index 79c52495be2f..1f7bd65c67c6 100755 --- a/lighthouse-core/scripts/publish-prepare-commit.sh +++ b/lighthouse-core/scripts/release/publish-prepare-commit.sh @@ -5,7 +5,7 @@ TXT_DIM=$(tput setaf 245) TXT_RESET=$(tput sgr0) DIRNAME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -LH_ROOT="$DIRNAME/../.." +LH_ROOT="$DIRNAME/../../.." cd "$LH_ROOT" set -euxo pipefail @@ -33,6 +33,7 @@ fi # Checkout a new branch for the version commit git fetch origin master git checkout origin/master +git log -n 1 git branch -D "$BRANCH_NAME" || true git checkout -b "$BRANCH_NAME" diff --git a/lighthouse-core/scripts/publish-prepare-package.sh b/lighthouse-core/scripts/release/publish-prepare-package.sh similarity index 87% rename from lighthouse-core/scripts/publish-prepare-package.sh rename to lighthouse-core/scripts/release/publish-prepare-package.sh index 4ffd084100a6..c5398c5d7cbb 100755 --- a/lighthouse-core/scripts/publish-prepare-package.sh +++ b/lighthouse-core/scripts/release/publish-prepare-package.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash DIRNAME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -LH_PRISTINE_ROOT="$DIRNAME/../../../lighthouse-pristine" +LH_PRISTINE_ROOT="$DIRNAME/../../../../lighthouse-pristine" set -euxo pipefail -bash "$DIRNAME/publish-prepare-pristine.sh" +bash "$DIRNAME/release-prepare-pristine.sh" cd "$LH_PRISTINE_ROOT" diff --git a/lighthouse-core/scripts/publish-prepare-pristine.sh b/lighthouse-core/scripts/release/publish-prepare-pristine.sh similarity index 80% rename from lighthouse-core/scripts/publish-prepare-pristine.sh rename to lighthouse-core/scripts/release/publish-prepare-pristine.sh index 2b79674ced0e..960136ed0569 100755 --- a/lighthouse-core/scripts/publish-prepare-pristine.sh +++ b/lighthouse-core/scripts/release/publish-prepare-pristine.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash DIRNAME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -LH_ROOT="$DIRNAME/../.." +LH_ROOT="$DIRNAME/../../.." cd $LH_ROOT set -euxo pipefail @@ -24,4 +24,4 @@ git fetch origin git fetch --tags git checkout -f master git reset --hard origin/master -git clean -fx +git clean -fdx # Forcibly clean all untracked files and directories, including `.gitignore`d ones. diff --git a/lighthouse-core/scripts/publish-test.sh b/lighthouse-core/scripts/release/publish-test.sh similarity index 93% rename from lighthouse-core/scripts/publish-test.sh rename to lighthouse-core/scripts/release/publish-test.sh index e6dc1508627f..2a5b527653f4 100755 --- a/lighthouse-core/scripts/publish-test.sh +++ b/lighthouse-core/scripts/release/publish-test.sh @@ -5,11 +5,11 @@ TXT_DIM=$(tput setaf 245) TXT_RESET=$(tput sgr0) DIRNAME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -LH_PRISTINE_ROOT="$DIRNAME/../../../lighthouse-pristine" +LH_PRISTINE_ROOT="$DIRNAME/../../../../lighthouse-pristine" set -euxo pipefail -bash "$DIRNAME/publish-prepare-pristine.sh" +bash "$DIRNAME/release-prepare-pristine.sh" cd "$LH_PRISTINE_ROOT"