Skip to content
This repository has been archived by the owner on Jul 23, 2021. It is now read-only.

Commit

Permalink
Add Algolia DocSearch secrets to CI build script (MetaMask#168)
Browse files Browse the repository at this point in the history
* Add Algolia secrets to CI build script

* Add DocSearch variables to VuePress config

* Add dotenv for local env files
  • Loading branch information
rekmarks authored Aug 31, 2020
1 parent 73bd8e8 commit b8d45b3
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 4 deletions.
7 changes: 6 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ jobs:
- run:
name: Build
command: |
if [[ -z "$ALGOLIA_API_KEY" || -z "$ALGOLIA_INDEX_NAME" ]]
then
printf 'ERROR: %s\n' 'Algolia API key or index name not set.' >&2
exit 1
fi
yarn build
- persist_to_workspace:
root: .
Expand All @@ -81,7 +86,7 @@ jobs:
git config --global user.email $GH_EMAIL
git config --global user.name $GH_NAME
git checkout $TARGET_BRANCH
rm -rf node_modules 00_Examples README.md package.json yarn.lock
find . -not -name docs -not -name LICENSE -delete
cp -r docs/dist/* .
rm -rf docs
git add -A
Expand Down
2 changes: 2 additions & 0 deletions .env-template
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALGOLIA_API_KEY=
ALGOLIA_INDEX_NAME=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
dist
.DS_Store
package-lock.json
.env
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
1. Open project in terminal and run `yarn`
2. Once install is finish run `yarn start` to run locally
3. Open your browser and it should be hosted on `localhost:8080/`

To enable Algolia DocSearch locally, run `cp .env-template .env` and populate
the fields with the correct values.
6 changes: 5 additions & 1 deletion docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = _ctx => ({
module.exports = (_ctx) => ({
dest: 'docs/dist',

locales: {
Expand Down Expand Up @@ -29,6 +29,10 @@ module.exports = _ctx => ({
editLinks: true,
logo: '/metamask-fox.svg',
smoothScroll: true,
algolia: {
apiKey: process.env.ALGOLIA_API_KEY,
indexName: process.env.ALGOLIA_INDEX_NAME,
},
locales: {
'/': {
label: 'English',
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"description": "MetaMask documentation.",
"scripts": {
"dev": "yarn start",
"start": "vuepress dev docs",
"build": "vuepress build docs",
"start": "node -r dotenv/config node_modules/.bin/vuepress dev docs",
"build": "node -r dotenv/config node_modules/.bin/vuepress build docs",
"lint": "prettier docs/guide/*.md docs/snippets/*",
"lint:fix": "yarn lint --write",
"view-info": "vuepress view-info docs",
Expand All @@ -30,6 +30,7 @@
"@vuepress/plugin-medium-zoom": "^1.5.4",
"@vuepress/plugin-pwa": "^1.5.4",
"@vuepress/theme-vue": "^1.5.4",
"dotenv": "^8.2.0",
"prettier": "^2.1.1",
"vue-tabs-component": "^1.5.0",
"vue-toasted": "^1.1.28",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3076,6 +3076,11 @@ dot-prop@^5.2.0:
dependencies:
is-obj "^2.0.0"

dotenv@^8.2.0:
version "8.2.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==

duplexer3@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
Expand Down

0 comments on commit b8d45b3

Please sign in to comment.