Created
August 15, 2021 08:25
-
-
Save smallcar88/64f2895c8f6213d324f6559947b914dc to your computer and use it in GitHub Desktop.
.circleci/config.yml for static site
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference | |
| #version: 2.1 | |
| # Use a package of configuration called an orb. | |
| #orbs: | |
| # Declare a dependency on the welcome-orb | |
| # welcome: circleci/welcome-orb@0.4.1 | |
| # Orchestrate or schedule a set of jobs | |
| #workflows: | |
| # Name the workflow "welcome" | |
| #welcome: | |
| # Run the welcome/run job in its own container | |
| #jobs: | |
| #- welcome/run | |
| executors: | |
| node: | |
| docker: | |
| - image: circleci/node:14 | |
| aliases: | |
| restore_cache: &restore_cache | |
| restore_cache: | |
| name: Restore Npm Package Cache | |
| keys: | |
| - yarn-cache-netlify-0.2.0-{{ checksum "yarn.lock" }} | |
| install_node_modules: &install_node_modules | |
| run: | |
| name: Install dependencies | |
| command: yarn | |
| save_cache: &save_cache | |
| save_cache: | |
| name: Save NPM package cache | |
| key: yarn-cache-netlify-0.2.0-{{ checksum "yarn.lock" }} | |
| paths: | |
| - ./node_modules | |
| version: 2.1 | |
| jobs: | |
| test: | |
| executor: node | |
| steps: | |
| - checkout | |
| - <<: *restore_cache | |
| - <<: *install_node_modules | |
| - <<: *save_cache | |
| - node/install-packages: | |
| pkg-manager: yarn | |
| - run: | |
| name: Test | |
| command: yarn test | |
| build: | |
| executor: node | |
| steps: | |
| - checkout | |
| - <<: *restore_cache | |
| - <<: *install_node_modules | |
| - run: | |
| name: Build | |
| command: yarn build | |
| - persist_to_workspace: | |
| root: ./ | |
| paths: | |
| - public | |
| deploy: | |
| executor: node | |
| steps: | |
| - checkout | |
| - attach_workspace: | |
| at: ./ | |
| - <<: *restore_cache | |
| - <<: *install_node_modules | |
| - run: | |
| name: Install netlify-cli | |
| command: sudo npm install --unsafe-perm=true -g --silent netlify-cli | |
| - run: | |
| name: Deploy to Netlify | |
| command: netlify deploy --dir=./ -p | |
| workflows: | |
| version: 2 | |
| build_and_deploy: | |
| jobs: | |
| - deploy: | |
| filters: | |
| branches: | |
| only: main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment