diff --git a/.circleci/config.yml b/.circleci/config.yml index 86122b6e..a921fa07 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,13 +25,6 @@ aliases: name: Install dependencies command: yarn install - - &install_hub_cli - name: Install hub - command: | - sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)" - eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) - brew install hub - defaults: &defaults working_directory: ~/repo docker: @@ -61,7 +54,6 @@ jobs: - restore_cache: *restore_yarn_cache - run: *run_yarn_install - save_cache: *save_yarn_cache - - run: *install_hub_cli - run: name: Prepare release command: | @@ -76,7 +68,6 @@ jobs: - restore_cache: *restore_yarn_cache - run: *run_yarn_install - save_cache: *save_yarn_cache - - run: *install_hub_cli - run: name: Try to Release command: yarn release:trigger diff --git a/GUIDE.md b/GUIDE.md index 6a99f6bc..e60046ab 100644 --- a/GUIDE.md +++ b/GUIDE.md @@ -3,7 +3,6 @@ - [Installation](#installation) - - [Install `hub`](#install-hub) - [Before running Shipjs](#before-running-shipjs) - [Dry Mode](#dry-mode) - [On your local machine](#on-your-local-machine) @@ -55,27 +54,6 @@ Add the following to the `scripts` section in your `package.json`. } ``` -### Install `hub` - -To use Ship.js, you need to install `hub`. - -```bash -brew install hub -``` - -To configure `hub`, create a file `~/.config/hub` and fill the following content: - -``` -github.com: -- user: YOUR-GITHUB-USERNAME - oauth_token: YOUR-PERSONAL-ACCESS-TOKEN - protocol: https -``` - -You can get an access token from [here](https://github.com/settings/tokens). - -Or you can simply run `hub api user`, follow the instruction and it will generate the token and write the config file for you. - ### Before running Shipjs Shipjs compares previous version. @@ -319,13 +297,6 @@ jobs: - run: name: Install command: yarn install - - run: - name: Install hub - command: | - sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)" - /home/linuxbrew/.linuxbrew/bin/brew shellenv >> $BASH_ENV - eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) - brew install hub - run: name: Prepare release command: | diff --git a/README.md b/README.md index 5945fa50..e23f606a 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ If the conditions are met, `shipjs trigger` will briefly do the following: - Run test, build and release it. - `git tag v1.0.1`. - Push them to git remote. -- `hub release create -m v1.0.1` +- Create a release on GitHub - Notify at Slack. You can run `shipjs trigger --dry-run` just to see what will be executed without actual execution. @@ -195,6 +195,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d + This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! diff --git a/packages/shipjs/src/flow/prepare.js b/packages/shipjs/src/flow/prepare.js index 2612ad9e..9be06892 100644 --- a/packages/shipjs/src/flow/prepare.js +++ b/packages/shipjs/src/flow/prepare.js @@ -2,7 +2,6 @@ import { getAppName, loadConfig, getReleaseType } from 'shipjs-lib'; import printHelp from '../step/prepare/printHelp'; import printDryRunBanner from '../step/printDryRunBanner'; -import checkHub from '../step/checkHub'; import validate from '../step/prepare/validate'; import validateMergeStrategy from '../step/prepare/validateMergeStrategy'; import pull from '../step/pull'; @@ -41,7 +40,6 @@ async function prepare({ printDryRunBanner(); } printDeprecated({ firstRelease, releaseCount }); - checkHub(); const config = loadConfig(dir); const { currentVersion, baseBranch } = validate({ config, dir }); validateMergeStrategy({ config }); diff --git a/packages/shipjs/src/helper/hubConfigured.js b/packages/shipjs/src/helper/hubConfigured.js deleted file mode 100644 index 30b16bd8..00000000 --- a/packages/shipjs/src/helper/hubConfigured.js +++ /dev/null @@ -1,12 +0,0 @@ -import { silentExec } from 'shipjs-lib'; - -export default function hubConfigured() { - return ( - silentExec( - `yes "" | GITHUB_TOKEN=${process.env.GITHUB_TOKEN || ''} hub release`, - { - ignoreError: true, - } - ).code === 0 - ); -} diff --git a/packages/shipjs/src/helper/hubInstalled.js b/packages/shipjs/src/helper/hubInstalled.js deleted file mode 100644 index a1b37935..00000000 --- a/packages/shipjs/src/helper/hubInstalled.js +++ /dev/null @@ -1,5 +0,0 @@ -import { silentExec } from 'shipjs-lib'; - -export default function hubInstalled() { - return silentExec('hub --version', { ignoreError: true }).code === 0; -} diff --git a/packages/shipjs/src/helper/index.js b/packages/shipjs/src/helper/index.js index 42776543..adb2271b 100644 --- a/packages/shipjs/src/helper/index.js +++ b/packages/shipjs/src/helper/index.js @@ -5,6 +5,4 @@ export { default as validateBeforePrepare } from './validateBeforePrepare'; export { default as getChangelog } from './getChangelog'; export { default as extractSpecificChangelog } from './extractSpecificChangelog'; export { default as gitPush } from './gitPush'; -export { default as hubInstalled } from './hubInstalled'; -export { default as hubConfigured } from './hubConfigured'; export { default as runPrettier } from './runPrettier'; diff --git a/packages/shipjs/src/step/__tests__/checkHub.spec.js b/packages/shipjs/src/step/__tests__/checkHub.spec.js deleted file mode 100644 index 2850d4cc..00000000 --- a/packages/shipjs/src/step/__tests__/checkHub.spec.js +++ /dev/null @@ -1,39 +0,0 @@ -import { print, exitProcess } from '../../util'; -import { hubInstalled, hubConfigured } from '../../helper'; -import { mockPrint } from '../../../tests/util'; -import checkHub from '../checkHub'; - -describe('checkHub', () => { - it('prints error if it is not installed', () => { - const output = []; - mockPrint(print, output); - hubInstalled.mockImplementationOnce(() => false); - checkHub(); - expect(output).toMatchInlineSnapshot(` - Array [ - "› Checking if \`hub\` exists.", - "You need to install \`hub\` first.", - " > https://github.com/algolia/shipjs/blob/master/GUIDE.md#install-hub", - ] - `); - expect(exitProcess).toHaveBeenCalledTimes(1); - expect(exitProcess).toHaveBeenCalledWith(1); - }); - - it('prints error if it is not configured', () => { - const output = []; - mockPrint(print, output); - hubInstalled.mockImplementationOnce(() => true); - hubConfigured.mockImplementationOnce(() => false); - checkHub(); - expect(output).toMatchInlineSnapshot(` - Array [ - "› Checking if \`hub\` exists.", - "You need to configure \`hub\`.", - " > https://github.com/algolia/shipjs/blob/master/GUIDE.md#install-hub", - ] - `); - expect(exitProcess).toHaveBeenCalledTimes(1); - expect(exitProcess).toHaveBeenCalledWith(1); - }); -}); diff --git a/packages/shipjs/src/step/checkHub.js b/packages/shipjs/src/step/checkHub.js deleted file mode 100644 index 7d904d56..00000000 --- a/packages/shipjs/src/step/checkHub.js +++ /dev/null @@ -1,26 +0,0 @@ -import runStep from './runStep'; -import { print, exitProcess } from '../util'; -import { hubInstalled, hubConfigured } from '../helper'; -import { error } from '../color'; - -export default () => - runStep( - { - title: 'Checking if `hub` exists.', - }, - () => { - if (!hubInstalled()) { - print(error('You need to install `hub` first.')); - print( - ' > https://github.com/algolia/shipjs/blob/master/GUIDE.md#install-hub' - ); - exitProcess(1); - } else if (!hubConfigured()) { - print(error('You need to configure `hub`.')); - print( - ' > https://github.com/algolia/shipjs/blob/master/GUIDE.md#install-hub' - ); - exitProcess(1); - } - } - ); diff --git a/packages/shipjs/src/step/release/__tests__/createGitHubRelease.spec.js b/packages/shipjs/src/step/release/__tests__/createGitHubRelease.spec.js index 9fa230a3..2b617dcc 100644 --- a/packages/shipjs/src/step/release/__tests__/createGitHubRelease.spec.js +++ b/packages/shipjs/src/step/release/__tests__/createGitHubRelease.spec.js @@ -4,7 +4,6 @@ import mime from 'mime-types'; import { getRepoInfo } from 'shipjs-lib'; import Octokit from '@octokit/rest'; import createGitHubRelease from '../createGitHubRelease'; -import { hubInstalled, hubConfigured } from '../../../helper'; jest.mock('temp-write'); jest.mock('@octokit/rest'); jest.mock('globby'); @@ -38,8 +37,6 @@ Octokit.mockImplementation(function() { describe('createGitHubRelease', () => { beforeEach(() => { - hubInstalled.mockImplementation(() => true); - hubConfigured.mockImplementation(() => true); getRepoInfo.mockImplementation(() => ({ owner: 'my', name: 'repo', diff --git a/packages/shipjs/src/step/release/createGitHubRelease.js b/packages/shipjs/src/step/release/createGitHubRelease.js index 72b437ad..540231d3 100644 --- a/packages/shipjs/src/step/release/createGitHubRelease.js +++ b/packages/shipjs/src/step/release/createGitHubRelease.js @@ -5,16 +5,13 @@ import Octokit from '@octokit/rest'; import mime from 'mime-types'; import { getRepoInfo } from 'shipjs-lib'; import runStep from '../runStep'; -import { getChangelog, hubInstalled, hubConfigured } from '../../helper'; +import { getChangelog } from '../../helper'; import { print } from '../../util'; -const cannotUseHub = () => !hubInstalled() || !hubConfigured(); - export default async ({ version, config, dir, dryRun }) => await runStep( { title: 'Creating a release on GitHub repository', - skipIf: cannotUseHub, }, async () => { const { diff --git a/packages/shipjs/src/step/setup/addCircleCIConfig.js b/packages/shipjs/src/step/setup/addCircleCIConfig.js index 63cfba2f..31683f1c 100644 --- a/packages/shipjs/src/step/setup/addCircleCIConfig.js +++ b/packages/shipjs/src/step/setup/addCircleCIConfig.js @@ -75,14 +75,6 @@ aliases: curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.16.0 echo 'export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"' >> $BASH_ENV - - &install_hub - name: Install hub CLI - command: | - sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)" - /home/linuxbrew/.linuxbrew/bin/brew shellenv >> $BASH_ENV - eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) - brew install hub - - &restore_yarn_cache name: Restore Yarn cache keys: @@ -125,7 +117,6 @@ jobs: - restore_cache: *restore_yarn_cache - run: *run_yarn_install - save_cache: *save_yarn_cache - - run: *install_hub - run: name: Prepare release command: | @@ -141,7 +132,6 @@ jobs: - restore_cache: *restore_yarn_cache - run: *run_yarn_install - save_cache: *save_yarn_cache - - run: *install_hub - run: name: Try to Release command: yarn release:trigger