From 72ab1cd2566d36a64bac6fe5c78f633b9b9f03c3 Mon Sep 17 00:00:00 2001 From: Mayo Jordanov Date: Wed, 5 Jun 2024 15:14:22 -0700 Subject: [PATCH] Update to workflows to build only on the public branch --- .circleci/config.yml | 111 +++++++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 52 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ab04cb4..29c62e3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,58 +3,65 @@ # Check https://circleci.com/docs/2.0/language-python/ for more details # version: 2 -jobs: +workflows: build: - working_directory: ~/repo - - docker: - - image: cimg/python:3.11.1 - - steps: - - restore_cache: - key: git-v1-{{ .Branch }} - - - checkout - - - run: - name: Update git submodules - command: | - git submodule sync - git submodule update --init - - - save_cache: - key: git-v1-{{ .Branch }} - paths: - - .git - - - restore_cache: - key: venv-v1-{{ .Branch }}-{{ checksum "requirements.txt" }} - - - restore_cache: - key: site-v3-{{ .Branch }}-webmention_cache- - - - run: - name: Setup and update Python environment - command: | - python -m virtualenv venv - . venv/bin/activate - pip install -r requirements.txt - - - save_cache: - key: venv-v1-{{ .Branch }}-{{ checksum "requirements.txt" }} - paths: - - ./venv - - - run: - name: Build - command: | - eval $(openssl aes-256-cbc -k "${ENCRYPTION_KEY}" -md sha256 -pbkdf2 -in environment.env.enc -d |grep -vE '(^#|^\s*$)') - . venv/bin/activate - python build.py - - - save_cache: - key: site-v3-{{ .Branch }}-webmention_cache-{{ checksum ".webmention_cache.json" }} - paths: - - .webmention_cache.json + jobs: + - build: + filters: + branches: + only: + - public + + working_directory: ~/repo + + docker: + - image: cimg/python:3.11.1 + + steps: + - restore_cache: + key: git-v1-{{ .Branch }} + + - checkout + + - run: + name: Update git submodules + command: | + git submodule sync + git submodule update --init + + - save_cache: + key: git-v1-{{ .Branch }} + paths: + - .git + + - restore_cache: + key: venv-v1-{{ .Branch }}-{{ checksum "requirements.txt" }} + + - restore_cache: + key: site-v3-{{ .Branch }}-webmention_cache- + + - run: + name: Setup and update Python environment + command: | + python -m virtualenv venv + . venv/bin/activate + pip install -r requirements.txt + + - save_cache: + key: venv-v1-{{ .Branch }}-{{ checksum "requirements.txt" }} + paths: + - ./venv + + - run: + name: Build + command: | + eval $(openssl aes-256-cbc -k "${ENCRYPTION_KEY}" -md sha256 -pbkdf2 -in environment.env.enc -d |grep -vE '(^#|^\s*$)') + . venv/bin/activate + python build.py + + - save_cache: + key: site-v3-{{ .Branch }}-webmention_cache-{{ checksum ".webmention_cache.json" }} + paths: + - .webmention_cache.json