# CircleCI pipeline to deploy my blog
Published on 28 March 2024

I am using JBake for this blog and using the free tier of Circle CI which is configured with Git using a webhook.
This is the pipeline that deploy automatically after a git push.

# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
  jbake-build:
    # Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
    # See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
    docker:
      - image: jbake/jbake:2.6.7
    # Add steps to the job
    # See: https://circleci.com/docs/2.0/configuration-reference/#steps
    steps:
      - checkout
      - run:
          name: "jbake build"
          command: "jbake -b"
      - persist_to_workspace:
          root: .
          paths:
            - "output"
  ftp-upload:
    docker:
      - image: com2ghz/ftp:latest
        environment:
            FTP_USER: $FTP_USER
            FTP_PW: $FTP_PW
    steps:
      - attach_workspace:
          at: /mnt
      - run:
          name: "Upload to site"
          shell: /bin/ash
          command: "ncftpput -R -v -u $FTP_USER -p $FTP_PW orhun.nl  /public_html /mnt/output/*"

# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
  build-jbake-workflow:
    jobs:
      - jbake-build:
          filters:
            branches:
              only:
                - master
      - ftp-upload:
          requires:
            - jbake-build