Merge pull request #40 from studiopress/BMO/GF-1933-git-to-s3

GF-1933 Git to SVN config in CircleCI
This commit is contained in:
Ben Moore
2020-04-02 13:17:23 -05:00
committed by GitHub
2 changed files with 153 additions and 13 deletions
+152 -13
View File
@@ -1,22 +1,161 @@
version: 2.1
jobs:
test:
commands:
install_dependencies:
description: "Install development dependencies."
steps:
- run: composer install
mkdir_artifacts:
description: "Make Artifacts directory"
steps:
- run:
command: |
[ ! -d "/tmp/artifacts" ] && mkdir /tmp/artifacts &>/dev/null
svn_setup:
description: "Setup SVN"
steps:
- mkdir_artifacts
- run:
command: |
cd /tmp/artifacts
SLUG=grep 'Text Domain:' /tmp/src/plugin.php | awk -F: '{print $2}' | sed 's/^\s//'
svn co https://plugins.svn.wordpress.org/$SLUG --depth=empty .
svn up trunk
svn up tags --depth=empty
cd trunk
rm -rf * .* *.*
cp -r /tmp/src/* .
svn propset svn:ignore -F .svnignore .
svn_add_changes:
description: "Add changes to SVN"
steps:
- deploy:
command: |
cd /tmp/artifacts
svn st | grep ^! | awk '{print " --force "$2}' | xargs svn rm
svn add --force .
svn_create_tag:
description: "Create a SVN tag"
steps:
- deploy:
command: |
cd /tmp/artifacts
VERSION=grep 'Version:' /tmp/src/plugin.php | awk -F: '{print $2}' | sed 's/^\s//'
svn cp trunk tags/$VERSION
svn_commit:
description: "Commit changes to SVN"
steps:
- deploy:
command: |
cd /tmp/artifacts
VERSION=grep 'Version:' /tmp/src/plugin.php | awk -F: '{print $2}' | sed 's/^\s//'
svn ci -m "Tagging $VERSION from Github" --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD"
executors:
base:
docker:
- image: circleci/buildpack-deps:latest
working_directory: /tmp
php_node:
docker:
- image: circleci/php:7.3.3-stretch-node-browsers
steps:
- checkout
- prepare-environment
- run: composer phpcs
working_directory: /tmp/src
commands:
prepare-environment:
description: "Install dependencies."
steps:
- run: composer install
jobs:
checkout:
executor: base
steps:
- checkout:
path: src
- persist_to_workspace:
root: /tmp
paths:
- src
checks:
executor: php_node
steps:
- attach_workspace:
at: /tmp
- install_dependencies
- run: composer phpcs
- persist_to_workspace:
root: /tmp
paths:
- src
deploy_svn_branch:
executor: base
steps:
- attach_workspace:
at: /tmp
- svn_setup
- svn_add_changes
- svn_commit
deploy_svn_tag:
executor: base
steps:
- attach_workspace:
at: /tmp
- svn_setup
- svn_add_changes
- svn_create_tag
- svn_commit
workflows:
version: 2
check-wp-cs:
checks:
jobs:
- test
- checkout
- checks:
requires:
- checkout
branch_deploy:
jobs:
- checkout:
filters:
branches:
only: master
- checks:
requires:
- checkout
filters:
branches:
only: master
- deploy_svn_branch:
context: genesis-svn
requires:
- checkout
- checks
filters:
branches:
only: master
tag_deploy:
jobs:
- checkout:
filters:
tags:
only: /^\d+\.\d+\.\d+$/
branches:
only: master
- checks:
requires:
- checkout
filters:
tags:
only: /^\d+\.\d+\.\d+$/
branches:
only: master
- deploy_svn_tag:
context: genesis-svn
requires:
- checkout
- checks
filters:
tags:
only: /^\d+\.\d+\.\d+$/
branches:
only: master
+1
View File
@@ -3,3 +3,4 @@
.gitattributes
.svnignore
node_modules
.circleci