Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CloudFlare - Invalidate cache on deployment #154

Merged
merged 12 commits into from
Jun 28, 2018
Merged

Conversation

alebabai
Copy link
Contributor

@alebabai alebabai commented Jun 26, 2018

what

  • use npm module to invalidate CloudFlare cache on deployment

why

@alebabai alebabai added the wip label Jun 26, 2018
Makefile Outdated
@@ -44,6 +46,7 @@ deps: deps-$(OS) \
packages/install/hugo \
packages/install/htmltest
asciinema auth
npm install -g cloudflare-cli
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version pin

Makefile Outdated

## Invalidate CloudFlare cache (all files)
invalidate-cache:
cfcli purge \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use @ here so our key is not exposed!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, let's use these instead:

CF_API_KEY # maps to token
CF_API_EMAIL # maps to email
CF_API_DOMAIN # maps to domain

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alebabai added 5 commits June 27, 2018 17:34
CF_API_KEY # maps to token
CF_API_EMAIL # maps to email
CF_API_DOMAIN # maps to domain
* use package.json to manage npm dependencies
* use fixed version of cfcli
* use invalidate-cache as npm script
package.json Outdated
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"invalidate-cache": "./node_modules/.bin/cfcli purge"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance we can just run cfcli purge directly from Makefile?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeap, we can do it by adding ./node_modules/.bin/ to the PATH.
But such kind of commands (that uses dev deps) wrapped into npm scrips.

alebabai added 3 commits June 27, 2018 19:21
* remove package.json
* install npm packages to global scope
* directly call cfcli from make file
@alebabai alebabai merged commit 896c7ab into master Jun 28, 2018
@alebabai alebabai deleted the feature/cloudflare-cache branch June 28, 2018 14:36
goruha added a commit that referenced this pull request Jul 23, 2018
* master:
  CloudFlare - Invalidate cache on deployment (#154)
  feat(hugo): bump version (#156)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants