Update CircleCI workflow
This commit is contained in:
@@ -3,6 +3,23 @@ defaults: &defaults
|
||||
docker:
|
||||
- image: circleci/node:10.15
|
||||
|
||||
semver-tags: &semver-tags
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
branches:
|
||||
ignore: /.*/
|
||||
develop: &develop
|
||||
filters:
|
||||
branches:
|
||||
only: develop
|
||||
other-branches: &other-branches
|
||||
filters:
|
||||
branches:
|
||||
ignore:
|
||||
- master
|
||||
- develop
|
||||
|
||||
version: 2
|
||||
jobs:
|
||||
install:
|
||||
@@ -41,7 +58,7 @@ jobs:
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths: .
|
||||
deploy:
|
||||
deploy-prod:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- attach_workspace:
|
||||
@@ -51,28 +68,63 @@ jobs:
|
||||
command: sudo apt install -y rsync
|
||||
- run:
|
||||
name: Deploy theme
|
||||
command: bash build/deploy.sh
|
||||
command: bash build/deploy.sh prod
|
||||
- run:
|
||||
name: Purge Cloudflare cache
|
||||
command: bash build/purge_cache.sh
|
||||
deploy-develop:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/tmp/windycoys
|
||||
- run:
|
||||
name: Install rsync
|
||||
command: sudo apt install -y rsync
|
||||
- run:
|
||||
name: Deploy theme
|
||||
command: bash build/deploy.sh develop
|
||||
- run:
|
||||
name: Purge Cloudflare cache
|
||||
command: bash build/purge_cache.sh
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
test-deploy:
|
||||
test:
|
||||
jobs:
|
||||
- install
|
||||
- install: *other-branches
|
||||
- test:
|
||||
<<: *other-branches
|
||||
requires:
|
||||
- install
|
||||
develop:
|
||||
jobs:
|
||||
- install: *develop
|
||||
- test:
|
||||
<<: *develop
|
||||
requires:
|
||||
- install
|
||||
- build:
|
||||
<<: *develop
|
||||
requires:
|
||||
- install
|
||||
- deploy:
|
||||
- deploy-develop:
|
||||
<<: *develop
|
||||
requires:
|
||||
- build
|
||||
- test
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- develop
|
||||
- build
|
||||
prod:
|
||||
jobs:
|
||||
- install: *semver-tags
|
||||
- test:
|
||||
<<: *semver-tags
|
||||
requires:
|
||||
- install
|
||||
- build:
|
||||
<<: *semver-tags
|
||||
requires:
|
||||
- install
|
||||
- deploy-prod:
|
||||
<<: *semver-tags
|
||||
requires:
|
||||
- test
|
||||
- build
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Ensure target is defined
|
||||
[ -z "$CIRCLE_BRANCH" ] && { echo >&2 "Error: Build target not defined. Aborting."; exit 1; }
|
||||
[ -z "$1" ] && { echo >&2 "Error: Build target not defined. Aborting."; exit 1; }
|
||||
|
||||
# Test rsync is installed and ENV variables are set
|
||||
hash rsync 2>/dev/null || { echo >&2 "Error: rsync is not installed. Aborting."; exit 1; }
|
||||
[ -z "$SSH_IP" ] && { echo >&2 "Error: SSH_IP is missing. Aborting."; exit 1; }
|
||||
[ -z "$SSH_USER" ] && { echo >&2 "Error: SSH_USER is missing. Aborting."; exit 1; }
|
||||
|
||||
echo "Deploying to $CIRCLE_BRANCH"
|
||||
|
||||
# Deploy theme with rsync
|
||||
rsync -e "ssh -o StrictHostKeyChecking=no" -avzuh --progress \
|
||||
theme/. $SSH_USER@$SSH_IP:~/windycoys_theme_$CIRCLE_BRANCH
|
||||
theme/. $SSH_USER@$SSH_IP:~/windycoys_theme_$1
|
||||
|
||||
Reference in New Issue
Block a user