From d03efe752cd1b789bf9974a592b13bab16c6a600 Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdxcode@users.noreply.github.com> Date: Sat, 27 Jan 2018 02:33:08 -0800 Subject: [PATCH] fix: fixing example publishing --- .circleci/config.yml | 17 ------- .circleci/release_example | 95 +++++++++++++++++++++------------------ 2 files changed, 52 insertions(+), 60 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 73631ef..0485333 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -117,16 +117,6 @@ jobs: - run: .circleci/setup_git - run: ./node_modules/.bin/nps release - example-multi-cli-typescript: &example - <<: *test - steps: - - add_ssh_keys - - checkout - - restore_cache: *restore_cache - - run: .circleci/yarn - - run: .circleci/setup_git - - run: .circleci/release_example - workflows: version: 2 create-dxcli: @@ -154,10 +144,3 @@ workflows: - node-8-single - node-8-plugin - node-8-multi - - example-multi-cli-typescript: &example_workflow - context: org-global - requires: - - release - # - example-multi-cli-javascript: *example_workflow - # - example-single-cli-typescript: *example_workflow - # - example-single-cli-javascript: *example_workflow diff --git a/.circleci/release_example b/.circleci/release_example index 4ae3f99..46cd4ee 100755 --- a/.circleci/release_example +++ b/.circleci/release_example @@ -7,47 +7,56 @@ sh.set('-ev') sh.exec('yarn link') const version = process.args[1] -const example = process.env.CIRCLE_JOB -const [, type,, format] = example.split('-') - -const options = format === 'typescript' ? - '--options=typescript,mocha,semantic-release' : - '--options=mocha,semantic-release' - -sh.cd(`examples/${example}`) -sh.exec('git fetch') -sh.exec('git checkout master') -sh.exec('git pull --rebase origin master') - -sh.rm('-rf', [ -'.circleci', -'.editorconfig', -'.eslintignore', -'.eslintrc', -'.gitattributes', -'.gitignore', -'README.md', -'appveyor.yml', -'bin', -'lib', -'package-scripts.js', -'src', -'test', -'tsconfig.json', -'tslint.json', -'yarn.lock', -]) - -const pjson = fs.readJSONSync('package.json') -fs.outputJSONSync('package.json', { - name: `@dxcli/${example}`, - repository: `dxcli/${example}`, - author: pjson.author, - version: pjson.version, - description: pjson.description, -}) -sh.exec(`create-dxcli ${type} --force --defaults ${options}`) -sh.exec('git add -A') -sh.exec(`git commit -m "fix: create-dxcli ${version}"`) -sh.exec('git push') +const examples = [ + 'example-multi-cli-javascript', + 'example-multi-cli-typescript', + 'example-single-cli-javascript', + 'example-single-cli-typescript', +] + +examples.forEach(example => { + const [, type,, format] = example.split('-') + + const options = format === 'typescript' ? + '--options=typescript,mocha,semantic-release' : + '--options=mocha,semantic-release' + + sh.cd(`examples/${example}`) + sh.exec('git fetch') + sh.exec('git checkout master') + sh.exec('git pull --rebase origin master') + + sh.rm('-rf', [ + '.circleci', + '.editorconfig', + '.eslintignore', + '.eslintrc', + '.gitattributes', + '.gitignore', + 'README.md', + 'appveyor.yml', + 'bin', + 'lib', + 'package-scripts.js', + 'src', + 'test', + 'tsconfig.json', + 'tslint.json', + 'yarn.lock', + ]) + + const pjson = fs.readJSONSync('package.json') + fs.outputJSONSync('package.json', { + name: `@dxcli/${example}`, + repository: `dxcli/${example}`, + author: pjson.author, + version: pjson.version, + description: pjson.description, + }) + + sh.exec(`create-dxcli ${type} --force --defaults ${options}`) + sh.exec('git add -A') + sh.exec(`git commit -m "fix: create-dxcli ${version}"`) + sh.exec('git push') +})