Skip to content

Commit

Permalink
Remove generated content from being tracked in Git (#1230)
Browse files Browse the repository at this point in the history
* Remove generated content

* Add deploy script

* Linting fixes

* Linting and README fixes

* Linting fixes

* Check branch is clean before deploying

* Uncapitalise non-default

* Linting fixes

* Improved deploy method

* Add PDFs back in

* Linting issues

* Uncomment commands

* Increment patch instead of major by default

* Fix typo

* Review feedback and other cleanups

* Fix typo

* Update src/tools/scripts/deploy.sh

Co-authored-by: Sawood Alam <[email protected]>

* Update src/tools/scripts/deploy.sh

Co-authored-by: Sawood Alam <[email protected]>

* Update src/tools/scripts/deploy.sh

Co-authored-by: Sawood Alam <[email protected]>

* Review feedback

* Update src/.gcloudignore

Co-authored-by: Rick Viscomi <[email protected]>

* README updates

* Make deploy.zip smaller

* Cleanup

Co-authored-by: Sawood Alam <[email protected]>
Co-authored-by: Rick Viscomi <[email protected]>
  • Loading branch information
3 people authored and sudheendrachari committed Sep 15, 2020
1 parent 7a5d810 commit 5d48246
Show file tree
Hide file tree
Showing 68 changed files with 152 additions and 55,140 deletions.
20 changes: 20 additions & 0 deletions src/.gcloudignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
# For more information, run:
# $ gcloud topic gcloudignore
#
# Note we are also using this for zip ignore in deploy.sh, so have to be a little
# bit more verbose than gcloud demands, to exclude items

.gcloudignore

# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:
Expand All @@ -16,8 +20,24 @@
# Python pycache:
__pycache__/
.pytest_cache/
__pycache__/*
.pytest_cache/*
**/__pycache__/*
**/.pytest_cache/*
*.pyc
**/*.pyc

# Ignored by the build system
/setup.cfg

env/
env/*
node_modules/
node_modules/*
static/html
static/html/*
.DS_Store
**/.DS_Store
Dockerfile
.dockerignore
deployed.zip
4 changes: 4 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.idea/
.vscode/
node_modules/
templates/*/*/chapters/
templates/*/*/ebook.html
templates/sitemap.xml
static/html/
deployed.zip
35 changes: 17 additions & 18 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ptw

The chapter generation is dependent on nodejs, so you will need to have [nodejs](https://nodejs.org/en/) installed as well. All of the following commands must be run from within the `src` directory by executing `cd src` first.

Note this is run automatically by a GitHub Action on merges to main, so does not need to be run manually.
Note this is run automatically by a GitHub Action on merges to main, so does not need to be run manually unless you want to run the site locally.

Install the dependencies:

Expand Down Expand Up @@ -152,28 +152,27 @@ _Make sure you have generated the ebooks PDFs first in the main branch, by runni
gcloud init
```

3. Stage the changes locally:

```
git checkout production
git status
git pull
git pull origin main
git push
```

- Check out the `production` branch
- Run `git status` to ensure you don't have any uncommitted changes locally
- Merge any remote changes (both origin/production and origin/main branches)
- Push the merge-commit back up to origin/production

4. Browse the website locally as one final QA test, then deploy the changes live:
3. Deploy the site:

```
npm run deploy
```

5. Browse the website in production to verify that the new changes have taken effect
The deploy script will do the following:
- Ask you to confirm you've updated the eBooks via GitHub Actions
- Switch to the production branch
- Merge changes from main
- Do a clean install
- Run the tests
- Ask you to complete any local tests and confirm good to deploy
- Ask for a version number (suggesing the last verision tagged and incrementing the patch)
- Tag the release (after asking you for the version number to use)
- Generate a `deploy.zip` file of what has been deployed
- Deploy to GCP
- Push changes to `production` branch on GitHub
- Ask you to update the release section of GitHub

4. Browse the website in production to verify that the new changes have taken effect. Not we have 3 hour caching so add random query params to pages to ensure you get latest version.

## Developing in Docker

Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"test": "node ./tools/test",
"generate": "node ./tools/generate",
"ebooks": "node ./tools/generate/generate_ebook_pdfs",
"deploy": "echo \"Y\" | gcloud app deploy --project webalmanac --stop-previous-version"
"deploy": "./tools/scripts/deploy.sh"
},
"devDependencies": {
"ejs": "^3.1.5",
Expand Down
381 changes: 0 additions & 381 deletions src/templates/en/2019/chapters/accessibility.html

This file was deleted.

684 changes: 0 additions & 684 deletions src/templates/en/2019/chapters/caching.html

This file was deleted.

1,587 changes: 0 additions & 1,587 deletions src/templates/en/2019/chapters/cdn.html

This file was deleted.

691 changes: 0 additions & 691 deletions src/templates/en/2019/chapters/cms.html

This file was deleted.

330 changes: 0 additions & 330 deletions src/templates/en/2019/chapters/compression.html

This file was deleted.

807 changes: 0 additions & 807 deletions src/templates/en/2019/chapters/css.html

This file was deleted.

635 changes: 0 additions & 635 deletions src/templates/en/2019/chapters/ecommerce.html

This file was deleted.

677 changes: 0 additions & 677 deletions src/templates/en/2019/chapters/fonts.html

This file was deleted.

692 changes: 0 additions & 692 deletions src/templates/en/2019/chapters/http2.html

This file was deleted.

426 changes: 0 additions & 426 deletions src/templates/en/2019/chapters/javascript.html

This file was deleted.

354 changes: 0 additions & 354 deletions src/templates/en/2019/chapters/markup.html

This file was deleted.

515 changes: 0 additions & 515 deletions src/templates/en/2019/chapters/media.html

This file was deleted.

334 changes: 0 additions & 334 deletions src/templates/en/2019/chapters/mobile-web.html

This file was deleted.

905 changes: 0 additions & 905 deletions src/templates/en/2019/chapters/page-weight.html

This file was deleted.

294 changes: 0 additions & 294 deletions src/templates/en/2019/chapters/performance.html

This file was deleted.

232 changes: 0 additions & 232 deletions src/templates/en/2019/chapters/pwa.html

This file was deleted.

272 changes: 0 additions & 272 deletions src/templates/en/2019/chapters/resource-hints.html

This file was deleted.

Loading

0 comments on commit 5d48246

Please sign in to comment.