Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemelia authored May 2, 2021
2 parents 8ff9b4d + 1e273de commit 27b0700
Show file tree
Hide file tree
Showing 15 changed files with 6,126 additions and 3,129 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 'CI'
on:
pull_request:
branches: [master]

jobs:
test_and_lint:
name: 'Test'
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v2
- uses: volta-cli/action@v1

- name: Get package manager's global cache path
id: global-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache package manager's global cache and node_modules
id: cache-dependencies
uses: actions/cache@v2
with:
path: |
${{ steps.global-cache-dir-path.outputs.dir }}
node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{
hashFiles('**/yarn.lock'
) }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-
- name: Install
run: yarn install

- name: Run tests and linting
run: yarn test




19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Constructs a revision key based on the most recent git tag and the currently che

##### revisionKey

The unique identifier of this build based on the git tag, followed by a the separator symbol (`+` by default), followed by the first 8 characters of the current commit hash.
The unique identifier of this build based on the git tag, followed by the separator symbol (`+` by default), followed by the first 8 characters of the current commit hash.

For example, if your most recent git tag is `v2.0.3`, and the current commit is `0993043d49f9e0[...]`, this generator will return a revision of `v2.0.3+0993043d`.

Expand All @@ -130,6 +130,10 @@ The timestamp of the current deploy

#### Configuration Options

##### commitHashLength

The length of the commit hash that is used when constructing the `revisionKey`.

##### separator

The text used to separate the tag name from the commit sha. By default, `+` is used.
Expand All @@ -150,7 +154,13 @@ For example, if the current commit is `0993043d49f9e0[...]`, this generator will

The timestamp of the current deploy

### Version Commit generator (`version-commit`)
#### Configuration Options

##### commitHashLength

The length of the commit hash that is used as the `revisionKey`.

### Version Commit generator

Similar to the Git Tag Commit generator but uses the `package.json` version string to construct the revision key instead of the git tag.

Expand All @@ -170,6 +180,10 @@ The timestamp of the current deploy

#### Configuration Options

##### commitHashLength

The length of the commit hash that is used when constructing the `revisionKey`.

##### separator

The text used to separate the tag name from the commit sha. By default, `+` is used.
Expand Down
68 changes: 54 additions & 14 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,60 @@
# Release
# Release Process

The following steps should navigate you through the release process to ensure as few issues as possible.
Releases are mostly automated using
[release-it](https://github.com/release-it/release-it/) and
[lerna-changelog](https://github.com/lerna/lerna-changelog/).

## Steps
## Preparation

### Commit the changelog, bump version, and publish to NPM
Since the majority of the actual release process is automated, the primary
remaining task prior to releasing is confirming that all pull requests that
have been merged since the last release have been labeled with the appropriate
`lerna-changelog` labels and the titles have been updated to ensure they
represent something that would make sense to our users. Some great information
on why this is important can be found at
[keepachangelog.com](https://keepachangelog.com/en/1.0.0/), but the overall
guiding principle here is that changelogs are for humans, not machines.

1. run `./bin/changelog` and add output to `CHANGELOG.md`
2. edit changelog output to be as user-friendly as possible (drop [INTERNAL] changes etc.)
3. `ember release`
4. `npm publish`
When reviewing merged PR's the labels to be used are:

### Create a github release
* breaking - Used when the PR is considered a breaking change.
* enhancement - Used when the PR adds a new feature or enhancement.
* bug - Used when the PR fixes a bug included in a previous release.
* documentation - Used when the PR adds or updates documentation.
* internal - Used for internal changes that still require a mention in the
changelog/release notes.

1. under `Releases` on GitHub choose `Draft New Release`
2. enter the new version number created above as the tag, prefixed with v e.g. (v0.1.12)
3. for release title choose a great name, no pressure.
4. in the description paste the upgrade instructions from the previous release, followed by the new CHANGELOG entry
5. publish the release
## Release

Once the prep work is completed, the actual release is straight forward:

* First, ensure that you have installed your projects dependencies:

```sh
yarn install
```

* Second, ensure that you have obtained a
[GitHub personal access token][generate-token] with the `repo` scope (no
other permissions are needed). Make sure the token is available as the
`GITHUB_AUTH` environment variable.

For instance:

```bash
export GITHUB_AUTH=abc123def456
```

[generate-token]: https://github.com/settings/tokens/new?scopes=repo&description=GITHUB_AUTH+env+variable

* And last (but not least 😁) do your release.

```sh
npx release-it
```

[release-it](https://github.com/release-it/release-it/) manages the actual
release process. It will prompt you to to choose the version number after which
you will have the chance to hand tweak the changelog to be used (for the
`CHANGELOG.md` and GitHub release), then `release-it` continues on to tagging,
pushing the tag and commits, etc.
85 changes: 0 additions & 85 deletions bin/changelog

This file was deleted.

10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ module.exports = {
separator: '+',
filePattern: 'index.html',
versionFile: 'package.json',

commitHashLength: function() {
if (this.type === 'git-commit') {
return 7;
} else {
return 8;
}
},

distDir: function(context) {
return context.distDir;
},
Expand All @@ -26,7 +35,6 @@ module.exports = {
scm: function(/* context */) {
return require('./lib/scm-data-generators')['git'];
}

},

prepare: function(/*context*/) {
Expand Down
8 changes: 7 additions & 1 deletion lib/data-generators/git-commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ var gitRepoInfo = require('git-repo-info');
var RSVP = require('rsvp');

module.exports = CoreObject.extend({
init: function(options) {
this._super();
this._plugin = options.plugin;
},

generate: function() {
var commitHashLength = this._plugin.readConfig('commitHashLength');
var info = gitRepoInfo();

if (info === null || info.root === null) {
return RSVP.reject('Could not find git repository');
}

var sha = info.sha.slice(0, 7);
var sha = info.sha.slice(0, commitHashLength);

if (!sha) {
return RSVP.reject('Could not build revision with commit hash `' + sha + '`');
Expand Down
3 changes: 2 additions & 1 deletion lib/data-generators/git-tag-commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = CoreObject.extend({
},

generate: function() {
var commitHashLength = this._plugin.readConfig('commitHashLength');
var separator = this._plugin.readConfig('separator');
var info = gitRepoInfo();

Expand All @@ -17,7 +18,7 @@ module.exports = CoreObject.extend({
}

var tag = info.tag;
var sha = info.sha.slice(0, 8);
var sha = info.sha.slice(0, commitHashLength);

if (!info.tag || !sha) {
return RSVP.reject('Could not build revision with tag `' + tag + '` and commit hash `' + sha + '`');
Expand Down
3 changes: 2 additions & 1 deletion lib/data-generators/version-commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = CoreObject.extend({
},

generate: function() {
var commitHashLength = this._plugin.readConfig('commitHashLength');
var separator = this._plugin.readConfig('separator');
var versionFile = this._plugin.readConfig('versionFile');

Expand All @@ -22,7 +23,7 @@ module.exports = CoreObject.extend({
return RSVP.reject('Could not find git repository');
}

var sha = (info.sha || '').slice(0, 8);
var sha = (info.sha || '').slice(0, commitHashLength);
var plugin = this._plugin;

return readFile(versionFile)
Expand Down
Loading

0 comments on commit 27b0700

Please sign in to comment.