Skip to content
This repository has been archived by the owner on Jan 20, 2023. It is now read-only.

Commit

Permalink
feat: use new plugins option and @semantic-release/apm plugin
Browse files Browse the repository at this point in the history
- Use `@semantic-release/apm` rather than custom code
- Use new semantic-release `plugins` option
- Update documentation
- Remove test as the shareable config is purely static

BREAKING CHANGE: require semantic-release@15.10.0 or above
  • Loading branch information
pvdlg committed Dec 1, 2018
1 parent a1e8c75 commit b5d20ca
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 673 deletions.
18 changes: 0 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ node_js:
- 10
- 8

services:
- docker

addons:
apt:
packages:
# See https://github.com/atom/ci
- libsecret-1-dev

# Trigger a push build on master and greenkeeper branches + PRs build on every branches
# Avoid double build on PRs (See https://github.com/travis-ci/travis-ci/issues/1147)
branches:
Expand All @@ -23,19 +14,10 @@ branches:
install:
# Retry install on fail to avoid failing a build on network/disk/external errors
- travis_retry npm install
# See https://github.com/atom/ci
- curl -s -O https://raw.githubusercontent.com/atom/ci/master/build-package.sh
- chmod u+x build-package.sh
- ./build-package.sh
# Add apm to the PATH
- export PATH=$PATH:~/atom/usr/bin

script:
- npm run test

after_success:
- npm run codecov

jobs:
include:
- stage: release
Expand Down
84 changes: 23 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,88 +1,50 @@
# @semantic-release/apm-config

[Semantic-release](https://github.com/semantic-release/semantic-release) shareable config for releasing atom packages with [apm](https://github.com/atom/apm).
[**semantic-release**](https://github.com/semantic-release/semantic-release) shareable config to publish [Atom](https://www.atom.io) packages with with [apm](https://github.com/atom/apm).

[![Travis](https://img.shields.io/travis/semantic-release/apm-config.svg)](https://travis-ci.org/semantic-release/apm-config)
[![Codecov](https://img.shields.io/codecov/c/github/semantic-release/apm-config.svg)](https://codecov.io/gh/semantic-release/apm-config)
[![Greenkeeper badge](https://badges.greenkeeper.io/semantic-release/apm-config.svg)](https://greenkeeper.io/)

[![npm latest version](https://img.shields.io/npm/v/@semantic-release/apm-config/latest.svg)](https://www.npmjs.com/package/@semantic-release/apm-config)
[![npm next version](https://img.shields.io/npm/v/@semantic-release/apm-config/next.svg)](https://www.npmjs.com/package/@semantic-release/apm-config)

## Usage
## Plugins

This shareable configuration use the following plugins:
- [`@semantic-release/commit-analyzer`](https://github.com/semantic-release/commit-analyzer)
- [`@semantic-release/git`](https://github.com/semantic-release/git)
- [`@semantic-release/release-notes-generator`](https://github.com/semantic-release/release-notes-generator)
- [`@semantic-release/npm`](https://github.com/semantic-release/npm)
- [`@semantic-release/exec`](https://github.com/semantic-release/exec)
- [`@semantic-release/changelog`](https://github.com/semantic-release/changelog)
- [`@semantic-release/github`](https://github.com/semantic-release/github)

### Local installation
## Install

```bash
$ npm install --save-dev semantic-release @semantic-release/apm-config
```

In `package.json`:
## Usage

The shareable config can be configured in the [**semantic-release** configuration file](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration):

```json
{
"release": {
"extends": "@semantic-release/apm-config"
}
"extends": "@semantic-release/apm-config"
}
```

### Global installation

```bash
$ npm install -g semantic-release @semantic-release/apm-config
$ semantic-release -e @semantic-release/apm-config
```

## Configuration

### Atom installation

The `apm` command line has to be installed in your CI environment and available in the `PATH`.

See the [Atom Package CI Scripts](https://github.com/atom/ci#atom-package-ci-scripts) documentation.

_Note: If you are running multiple versions of Atom in CI (Stable + Beta),
ensure that the `semantic-release` command is run on a build using the Stable
channel of Atom as the Beta channel builds only provide `apm-beta`. If you are
using [travis-deploy-once](https://github.com/semantic-release/travis-deploy-once)
this can be achieved by setting the Stable channel build to be the last build
to run, or by using the
[`buildLeaderId`](https://github.com/semantic-release/travis-deploy-once#-b---buildleaderid)
option._

### Atom authentication
See each [plugin](#plugins) documentation for required installation and configuration steps.

The Atom authentication configuration is **required** and can be set via [environment variables](#environment-variables).
### Overwritten options

Visit your account page on [Atom.io](https://atom.io/account) to obtain your authentication token. The token has to be made available in your CI environment via the `ATOM_ACCESS_TOKEN` environment variable.
This following options are set by this shareable config:

### GitHub authentication
| Option | Value |
|--------------------------------------------------------------|---------------------------------------------------|
| [`message`](https://github.com/semantic-release/git#message) | chore(release): \${nextRelease.version} [skip ci] |

The GitHub authentication configuration is **required** and can be set via [environment variables](#environment-variables).

See [GitHub authentication](https://github.com/semantic-release/github#github-authentication).

### Environment variables

| Variable | Description |
|------------------------------|----------------------------------------------------------------------|
| `GH_TOKEN` or `GITHUB_TOKEN` | **Required.** The token used to authenticate with GitHub repository. |
| `ATOM_ACCESS_TOKEN` | **Required.** The token used to authenticate with Atom registry. |

### Additional options

This shareable config uses the [`@semantic-release/git`](https://github.com/semantic-release/git), [`@semantic-release/npm`](https://github.com/semantic-release/npm), [`@semantic-release/exec`](https://github.com/semantic-release/exec), [`@semantic-release/changelog`](https://github.com/semantic-release/changelog) and [`@semantic-release/github`](https://github.com/semantic-release/github) plugins. See the documentation of each plugins for additional options.

Options can be set in the Semantic-release configuration.

For example to change the commit message:

```json
{
"release": {
"extends": "@semantic-release/apm-config",
"message": "chore: prepare %s release ${nextRelease.version} [skip ci]"
}
}
```
Other options use their default values. See each [plugin](#plugins) documentation for available options.
30 changes: 5 additions & 25 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,10 @@
const execa = require('execa');
const SemanticReleaseError = require('@semantic-release/error');

module.exports = {
verifyConditions: [
async () => {
if ((await execa('apm', ['-v'], {reject: false})).code !== 0) {
throw new SemanticReleaseError('The apm CLI must be installed.', 'ENOAPMCLI');
}
},
() => {
if (!process.env.ATOM_ACCESS_TOKEN) {
throw new SemanticReleaseError('The environment variable ATOM_ACCESS_TOKEN is required.', 'ENOAPMTOKEN');
}
},
{path: '@semantic-release/npm', npmPublish: false},
'@semantic-release/changelog',
'@semantic-release/git',
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
'@semantic-release/github',
],
prepare: [
'@semantic-release/changelog',
{path: '@semantic-release/npm', npmPublish: false},
{path: '@semantic-release/git', message: `chore(release): \${nextRelease.version} [skip ci]`},
],
publish: [
{path: '@semantic-release/exec', cmd: `apm publish --tag \${nextRelease.gitTag} 1>&2`},
'@semantic-release/github',
'@semantic-release/apm',
['@semantic-release/git', {message: `chore(release): \${nextRelease.version} [skip ci]`}],
],
};
39 changes: 6 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@semantic-release/apm-config",
"description": "Semantic-release shareable config for releasing atom packages with apm",
"description": "semantic-release shareable config to publish Atom packages with with apm",
"version": "0.0.0-development",
"author": "Pierre Vanduynslager (https://github.com/pvdlg)",
"bugs": {
Expand All @@ -16,32 +16,18 @@
"Gregor Martynus (https://twitter.com/gr2m)"
],
"dependencies": {
"@semantic-release/apm": "^1.0.0",
"@semantic-release/changelog": "^3.0.0",
"@semantic-release/error": "^2.1.0",
"@semantic-release/commit-analyzer": "^6.1.0",
"@semantic-release/exec": "^3.0.1",
"@semantic-release/git": "^7.0.0",
"@semantic-release/github": "^5.2.1",
"@semantic-release/npm": "^5.0.1",
"execa": "^1.0.0"
"@semantic-release/release-notes-generator": "^7.1.4"
},
"devDependencies": {
"ava": "^0.25.0",
"codecov": "^3.0.0",
"commitizen": "^3.0.0",
"cz-conventional-changelog": "^2.0.0",
"dockerode": "^2.5.3",
"fs-extra": "^7.0.0",
"get-stream": "^4.0.0",
"git-log-parser": "^1.2.0",
"got": "^9.0.0",
"mockserver-client": "^5.3.0",
"nyc": "^12.0.1",
"p-retry": "^2.0.0",
"semantic-release": "^15.0.0",
"sinon": "^6.0.0",
"strip-ansi": "^5.0.0",
"tempy": "^0.2.1",
"which": "^1.3.0",
"xo": "^0.23.0"
},
"engines": {
Expand All @@ -63,19 +49,8 @@
],
"license": "MIT",
"main": "index.js",
"nyc": {
"include": [
"index.js"
],
"reporter": [
"json",
"text",
"html"
],
"all": true
},
"peerDependencies": {
"semantic-release": ">=15.9.0 <16.0.0"
"semantic-release": ">=15.10.0 <16.0.0"
},
"prettier": {
"printWidth": 120,
Expand All @@ -91,10 +66,8 @@
},
"scripts": {
"cm": "git-cz",
"codecov": "codecov -f coverage/coverage-final.json",
"lint": "xo",
"semantic-release": "semantic-release",
"test": "nyc ava -v"
"test": "xo"
},
"xo": {
"prettier": true,
Expand Down
90 changes: 0 additions & 90 deletions test/helpers/git-utils.js

This file was deleted.

Loading

0 comments on commit b5d20ca

Please sign in to comment.