Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove hub #459

Merged
merged 2 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: |
Expand All @@ -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
Expand Down
29 changes: 0 additions & 29 deletions GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<!-- toc -->

- [Installation](#installation)
- [Install `hub`](#install-hub)
- [Before running Shipjs](#before-running-shipjs)
- [Dry Mode](#dry-mode)
- [On your local machine](#on-your-local-machine)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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: |
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <changelog> 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.
Expand Down Expand Up @@ -195,6 +195,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d

<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
2 changes: 0 additions & 2 deletions packages/shipjs/src/flow/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -41,7 +40,6 @@ async function prepare({
printDryRunBanner();
}
printDeprecated({ firstRelease, releaseCount });
checkHub();
const config = loadConfig(dir);
const { currentVersion, baseBranch } = validate({ config, dir });
validateMergeStrategy({ config });
Expand Down
12 changes: 0 additions & 12 deletions packages/shipjs/src/helper/hubConfigured.js

This file was deleted.

5 changes: 0 additions & 5 deletions packages/shipjs/src/helper/hubInstalled.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/shipjs/src/helper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
39 changes: 0 additions & 39 deletions packages/shipjs/src/step/__tests__/checkHub.spec.js

This file was deleted.

26 changes: 0 additions & 26 deletions packages/shipjs/src/step/checkHub.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -38,8 +37,6 @@ Octokit.mockImplementation(function() {

describe('createGitHubRelease', () => {
beforeEach(() => {
hubInstalled.mockImplementation(() => true);
hubConfigured.mockImplementation(() => true);
getRepoInfo.mockImplementation(() => ({
owner: 'my',
name: 'repo',
Expand Down
5 changes: 1 addition & 4 deletions packages/shipjs/src/step/release/createGitHubRelease.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 0 additions & 10 deletions packages/shipjs/src/step/setup/addCircleCIConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: |
Expand All @@ -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
Expand Down