create a new gatsby project

typescript

gatsby new $PROJECTNAME https://github.com/resir014/gatsby-starter-typescript-plus

default

gatsby new $PROJECTNAME

gitlab-ci.yml

stages:
  - build
  - deploy
  - invalidate-cache

build:
  stage: build
  image: node:11
  script:
    - npm install
    - npm run build
  artifacts:
    paths:
      - public

deploy:
  image: garland/aws-cli-docker
  stage: deploy
  script:
    - aws s3 sync public/ s3://$S3_BUCKETNAME

invalidate-cache:
  image: garland/aws-cli-docker
  stage: invalidate-cache
  script:
    - aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths '/*'