diff --git a/.circleci/config.yml b/.circleci/config.yml index 1b0614d..d5f6a33 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,22 +1,72 @@ version: 2.1 -jobs: - test: +commands: + install_dependencies: + description: "Install development dependencies." + steps: + - run: composer install + +executors: + base: + docker: + - image: circleci/buildpack-deps:latest + working_directory: /tmp + php_node: docker: - image: circleci/php:7.3.3-stretch-node-browsers + working_directory: /tmp/src + +jobs: + checkout: + executor: base steps: - - checkout - - prepare-environment + - checkout: + path: src + - persist_to_workspace: + root: /tmp + paths: + - src + + standards: + executor: php_node + steps: + - attach_workspace: + at: /tmp + - install_dependencies - run: composer phpcs -commands: - prepare-environment: - description: "Install dependencies." - steps: - - run: composer install + deploy_svn: + executor: base + steps: + - attach_workspace: + at: /tmp + - run: + command: | + SLUG=grep 'Text Domain:' ./plugin.php | awk -F: '{print $2}' | sed 's/^\s//' + VERSION=grep 'Version:' ./plugin.php | awk -F: '{print $2}' | sed 's/^\s//' + chmod +x ./svn-deploy.sh + ./svn-deploy.sh workflows: version: 2 - check-wp-cs: + check-standards: jobs: - - test + - checkout: + filters: + tags: + only: /.*/ + - standards: + filters: + tags: + only: /.*/ + requires: + - checkout + - deploy_svn: + requires: + - checkout + - standards + filters: + tags: + only: /.*/ + branches: + only: master diff --git a/.circleci/svn-deploy.sh b/.circleci/svn-deploy.sh new file mode 100644 index 0000000..1e6f7f5 --- /dev/null +++ b/.circleci/svn-deploy.sh @@ -0,0 +1,23 @@ +#!/bin/bash +CURDIR=$(pwd); +TMPDIR=~/.plugin-release-script; + +mkdir $TMPDIR; +cd $TMPDIR; +svn co https://plugins.svn.wordpress.org/$SLUG --depth=empty .; +svn up trunk +svn up tags --depth=empty +cd trunk; +rm -rf * .* *.*; +### Clone the repo at the specific version tag +git clone --branch $VERSION git@github.com:$SLUG.git --depth 1 . +### This is where you would run any build commands +svn propset svn:ignore -F .svnignore .; +cd ../; +svn st | grep ^! | awk '{print " --force "$2}' | xargs svn rm; +svn add --force .; +svn cp trunk tags/$VERSION; +svn ci -m "Tagging $VERSION from Github" --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD"; +cd $CURDIR; +rm -rf $TMPDIR; +echo 'Done!'; diff --git a/.svnignore b/.svnignore index b74f328..7a30b5e 100644 --- a/.svnignore +++ b/.svnignore @@ -3,3 +3,4 @@ .gitattributes .svnignore node_modules +.circlci