Skip to content

Instantly share code, notes, and snippets.

@bgreater
Created October 3, 2019 01:08
Show Gist options
  • Save bgreater/07ee09f6f95ac8d51de0afc89779ff80 to your computer and use it in GitHub Desktop.
Save bgreater/07ee09f6f95ac8d51de0afc89779ff80 to your computer and use it in GitHub Desktop.
bitbucket pipeline for a nuxt.js project with s3 deployment and cloudflare cache clear
# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:10.15.3
pipelines:
branches:
master:
- step:
name: Build and Test
caches:
- node
script:
- npm set audit false
- npm install
- npm run precommit
- npm run generate
artifacts:
- dist/**
- step:
name: Deploy
deployment: production
script:
- pipe: atlassian/aws-s3-deploy:0.2.1
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_REGION
S3_BUCKET: $AWS_BUCKET_NAME
LOCAL_PATH: $AWS_LOCAL_PATH
ACL: "public-read"
CACHE_CONTROL: "max-age=30672000"
DELETE_FLAG: "true"
- step:
name: Clear CloudFlare Cache
script:
- curl -X POST "https://api.cloudflare.com/client/v4/zones/${CF_ZONE}/purge_cache" -H "X-Auth-Email:${CF_EMAIL}" -H "X-Auth-Key:${CF_AUTH_KEY}" -H "Content-Type:application/json" --data '{"purge_everything":true}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment