Skip to content

Commit

Permalink
Infra/Docs: Use formideploy for docs deployment (#899)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-roemer committed Jun 11, 2020
1 parent 930d8d3 commit e57c685
Show file tree
Hide file tree
Showing 9 changed files with 11,471 additions and 121 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -2,7 +2,6 @@
/node_modules
/*/node_modules
package-lock.json
yarn.lock

# testing
/coverage
Expand Down
50 changes: 40 additions & 10 deletions .travis.yml
Expand Up @@ -3,7 +3,7 @@ language: node_js
node_js:
- '10'
- '12'
- '13'
- '14'

# Use container-based Travis infrastructure.
sudo: false
Expand All @@ -14,17 +14,21 @@ branches:

env:
global:
# **Staging**: surge (`Surge.sh`)
# **GitHub**: `GitHub (spectacle-ci)` "Tokens"
# GITHUB_DEPLOYMENT_TOKEN
- secure: "sAa4I9Xu3xJJnRp6l2V24Oqapuw1ioiUkFvEIM8cI9o3Jx73OYKz1aw9qmwUlXu/xJVBqcgYlW3iAuUf+e6OufHtlwi0RrTnJv9lfrKNkij5G/grNpgmaXDBi5HWzAykewDNpfZwF5xIcS7+8Kl2R8a2Lym4Rqp+UgLQ/KZCmt1vTuOpK5JNLpf5Y8goB3XcXN6nNzZ4f0JDREQVRWXmVmYImY8jTFyhCxz/3OsffsZqSTs/r6UW0djGqEyV/Ur9HyIqqqCmuhrCphzuK8eYVjk8VSaBhxQSTJDl9cDQarqdzYEa3R+kJ+6i+yzlN7PIji7MUZTt339/eTgn2JIFBR+nokxRo19lm6BMuO5dTBZyzi9q1ZbSXWNV9EM72pXvyV+nzVLvwt830cRojmK1BZv7tu0M9AzzS9zbEYMmG9ZWMUWhfEgSq50GpJSz5YepLOK+XU7B9ceP1zb58LNqx4Yf/tW1hG2bmtrkV2qd1l2AwpvpzdqFY9PzDwXzd6b2mDyyF8w3vy/9C8FmBtK+pa34H/39k/Xwshbhrn7cSxd5OtmUAyl+DZoiavrR6eYuwspyvopSRCFdaR6g8K32C1Q9sfMHeGs1my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azaMBPd49iKrCEevivmixH/c/UXH7jjp8+Z6m8WOX2fj/NijOGc0ASJwCvHYejCRduM1JxjRTqufA7J1Be4pjI7NHTyQmCzMlEQO7YysfaVrIvbSZ1ohTZD4WG1nPK28pQwPVELDMNngpXcRZ95ubSMamc7p9+hfL0AubqzI7ULWiiLRAYTQfTmCcrS1GllqOVCoICtJ/ymTtVFQoyVEi+SgBxQBwPkvUoZsDzHCrYKQ2o1F4sDBNdbEFNzf81yM8q7gmQnkM2JGdqwK/dFz/38jXojVhpzociZio5fwwE2F3EanKCow0Puxj8YVmqCw6mfq4L4r0p5LcsZ+NrXZum1mL0vrv+Mwy2odhVXX1rBoG1DKCM3bSCafsx0m9Kgh7er+1yI9Q+IqmiK+rVTuq6nSBg5K5gL/rPL6on5JTI="

# **Production**: AWS (`spectacle-ci`, "CI" keys)
# **Production**: `AWS IAM (spectacle-ci)` "Access Keys > CI"
# AWS_ACCESS_KEY_ID
- secure: "WkiLFFTXdyLOguGxaHul2a6DG+kts4qa9MOVR0NqI9T5D9jpudjNEuLV/zRPIhn3Zvhc5eZxh8Wt3W9S2cM3OXz8r1i32nc8IMPBq2FlwWowMCGT7fLkDZCJ70sF6njsowatqCgohzX+PokgZD2GRy7D3gu3zPFpZYmvCo35ppI6CbrLjHf0kP1F5Dzds5nJCRM0ikOWD3aIcPLlXH0LrLvyAfkbsFZLBUlRcwECKxynQ8B7PJCxIQM1fLWUNIsTudxDXAcKZCHvZg9ll7GbtmBIjW65deO2WRok3jqDGTQXz8Slga+gA3eN3or9dG5sVdML41u2xu31YXJIeORu6sjhul53T8Ef+AEwMohH0QLCPQzPZPiZL9Vx747dLPUwbNxX9H5TGUhMHvuAh8dVDsJg6qXtykLJJ/yZuPy60ST6ZeMBUfqOGwTx9m4sojr86Q7qHgrciiYYFt54FoNk8NH4tc73Khb+zw5cGsqAUSFY1O6vXy2ORVyIjkzX/61gokkM9JIp1Q4mU9urUuJh9tIxK5VyhjsWEelVNPs6c7IgDJXmbSzez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N3UpZv5ayfEUxCsZCR9f6tRlhJgHy7g0Epb+VX0="

before_install:
# Add `aws` CLI tool.
Expand All @@ -41,6 +45,21 @@ notifications:
on_failure: always

script:
- yarn --version
- node --version
- aws --version

# Conditionally build core.
#
# Note: If there is an empty diff (like git internal catchup) this will exit 1 with
# stack trace which is still what we want (no changes).
# See: https://reflectoring.io/skip-ci-build/#using-a-git-diff-in-the-ci-build
- export CHANGED_FILES=$(git diff --name-only $TRAVIS_COMMIT_RANGE)
- |
npx -q match-str -e "^(docs\/)" -s "${CHANGED_FILES}" && \
{ echo "[CHANGES] Building core."; } || \
{ echo "[NO CHANGES] No core changes. Skipping build."; travis_terminate 0; }
# Core library
- yarn run build
# Build all examples to make sure they're not broken.
Expand All @@ -53,22 +72,33 @@ jobs:
- stage: documentation
node_js: '12'
script:
# Only do the docs build/deploy if docs changes.
# We early terminate the entire job which should also skip `deploy` tasks.
#
# Note: If there is an empty diff (like git internal catchup) this will exit 1 with
# stack trace which is still what we want (no changes).
# See: https://reflectoring.io/skip-ci-build/#using-a-git-diff-in-the-ci-build
- export CHANGED_FILES=$(git diff --name-only $TRAVIS_COMMIT_RANGE)
- |
npx -q match-str -i "^(\.travis\.yml|docs\/)" -s "${CHANGED_FILES}" && \
{ echo "[CHANGES] Building docs."; } || \
{ echo "[NO CHANGES] No doc changes. Skipping build + deploy."; travis_terminate 0; }
# Install, test.
- cd docs
- yarn install --frozen-lockfile
- yarn run check-ci

# Build and deploy to staging.
- yarn run clean
- yarn run build
- yarn run deploy:stage

deploy:
# Deploy master to production
- provider: script
# Build and deploy to production.
# _Note_: `deploy.script` must be a **single** command string
script: >-
yarn run clean &&
yarn run build &&
yarn run deploy:prod
script: yarn run deploy:prod
skip_cleanup: true
on:
branch: master
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Expand Up @@ -182,7 +182,7 @@ ahead and submit a PR, make sure that you have done the following:
```sh
# (1) Update the Changelog, following format from previous versions
# and commit those changes independently of other updates
git add CHANGELOG.md && git commit -m "Changes for v<version>"
$ git add CHANGELOG.md && git commit -m "Changes for v<version>"

# (2) Run tests, lint, build published dir, update package.json
$ npm version [patch|minor|major|<version>]
Expand Down
8 changes: 8 additions & 0 deletions docs/formideploy.config.js
@@ -0,0 +1,8 @@
/**
* Formideploy configuration overrides.
*/
module.exports = {
lander: {
name: 'spectacle'
}
};
27 changes: 13 additions & 14 deletions docs/package.json
Expand Up @@ -20,13 +20,15 @@
"prettier-all": "prettier --write '{src,static.config,scripts,content}/**/*.{js,jsx,md}'",
"preversion": "yarn run lint && yarn run build",
"build": "react-static build",
"serve": "serve -l 4000",
"deploy:prod": "node scripts/deploy/aws.js",
"deploy:stage": "node scripts/deploy/surge.js",
"serve": "formideploy serve --port 4000",
"deploy:stage": "formideploy deploy --staging",
"deploy:prod": "formideploy deploy --production",
"start": "react-static start",
"test-local": "node test/spectacle-integration.js"
},
"dependencies": {
"@babel/cli": "^7.2.0",
"@babel/core": "^7.2.0",
"@babel/node": "^7.2.0",
"@mdx-js/react": "^1.5.8",
"array-shuffle": "^1.0.1",
Expand All @@ -39,22 +41,26 @@
"jdown": "^0.3.0",
"klaw": "^2.1.1",
"mdast": "^3.0.0",
"prism-react-renderer": "^1.1.0",
"prismjs": "^1.15.0",
"prop-types": "^15.6.2",
"react": "^16.8.0",
"react-copy-to-clipboard": "^5.0.1",
"react-document-meta": "^2.0.3",
"react-dom": "^16.8.0",
"react-ga": "^2.4.1",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-router-ga": "^1.0.0",
"react-router-scroll": "^0.2.0",
"react-static": "^7.2",
"react-static-plugin-md-pages": "^0.1.x",
"react-static-plugin-react-router": "^7.2.3",
"react-static-plugin-sitemap": "^7.2.3",
"react-static-plugin-styled-components": "^7.2.2",
"styled-components": "^4.1.1"
},
"devDependencies": {
"@babel/cli": "^7.2.0",
"@babel/core": "^7.2.0",
"eslint-config-formidable": "^4.0.0",
"eslint-config-prettier": "^4.1.0",
"eslint-config-react-tools": "1.x.x",
Expand All @@ -63,16 +69,9 @@
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-react-hooks": "^2.3.0",
"execa": "^4.0.0",
"formideploy": "^0.3.2",
"prettier": "^1.15.1",
"puppeteer": "^1.13.0",
"react-document-meta": "^2.0.3",
"react-router-scroll": "^0.2.0",
"react-static-plugin-react-router": "^7.2.3",
"react-static-plugin-sitemap": "^7.2.3",
"react-static-plugin-styled-components": "^7.2.2",
"rimraf": "^3.0.0",
"serve": "^11.3.0",
"spectacle": "^5.0.0",
"surge": "^0.21.3"
"rimraf": "^3.0.0"
}
}
57 changes: 0 additions & 57 deletions docs/scripts/deploy/aws.js

This file was deleted.

37 changes: 0 additions & 37 deletions docs/scripts/deploy/surge.js

This file was deleted.

0 comments on commit e57c685

Please sign in to comment.