Skip to content

Commit 79f9ee6

Browse files
committed
Merge branch 'master' into ancestor-tags
2 parents 3737824 + 089d1d8 commit 79f9ee6

File tree

16 files changed

+6143
-3153
lines changed

16 files changed

+6143
-3153
lines changed

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: 'CI'
2+
on:
3+
pull_request:
4+
branches: [master]
5+
6+
jobs:
7+
test_and_lint:
8+
name: 'Test'
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 5
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: volta-cli/action@v1
15+
16+
- name: Get package manager's global cache path
17+
id: global-cache-dir-path
18+
run: echo "::set-output name=dir::$(yarn cache dir)"
19+
20+
- name: Cache package manager's global cache and node_modules
21+
id: cache-dependencies
22+
uses: actions/cache@v2
23+
with:
24+
path: |
25+
${{ steps.global-cache-dir-path.outputs.dir }}
26+
node_modules
27+
key: ${{ runner.os }}-${{ matrix.node-version }}-${{
28+
hashFiles('**/yarn.lock'
29+
) }}
30+
restore-keys: |
31+
${{ runner.os }}-${{ matrix.node-version }}-
32+
33+
- name: Install
34+
run: yarn install
35+
36+
- name: Run tests and linting
37+
run: yarn test
38+
39+
40+
41+

.travis.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
# Change Log
2+
## v2.0.0-beta.0 (2021-05-02)
3+
4+
#### :rocket: Enhancement
5+
* [#71](https://github.com/ember-cli-deploy/ember-cli-deploy-revision-data/pull/71) Allow custom commit hash length when constructing revisionKey ([@HeroicEric](https://github.com/HeroicEric))
6+
7+
#### :house: Internal
8+
* [#75](https://github.com/ember-cli-deploy/ember-cli-deploy-revision-data/pull/75) Bump js-yaml from 3.8.2 to 3.14.1 ([@dependabot[bot]](https://github.com/apps/dependabot))
9+
* [#74](https://github.com/ember-cli-deploy/ember-cli-deploy-revision-data/pull/74) Bump websocket-extensions from 0.1.1 to 0.1.4 ([@dependabot[bot]](https://github.com/apps/dependabot))
10+
* [#73](https://github.com/ember-cli-deploy/ember-cli-deploy-revision-data/pull/73) Upgrade deps ([@lukemelia](https://github.com/lukemelia))
11+
12+
#### Committers: 5
13+
- Ed Fricker ([@beastawakens](https://github.com/beastawakens))
14+
- Eric Kelly ([@HeroicEric](https://github.com/HeroicEric))
15+
- Luke Melia ([@lukemelia](https://github.com/lukemelia))
16+
- Michal Bryxí ([@MichalBryxi](https://github.com/MichalBryxi))
17+
- Pepijn Schoen ([@duizendnegen](https://github.com/duizendnegen))
18+
219
## [v1.0.0](https://github.com/ember-cli-deploy/ember-cli-deploy-revision-data/tree/v1.0.0) (2017-03-25)
320
[Full Changelog](https://github.com/ember-cli-deploy/ember-cli-deploy-revision-data/compare/v1.0.0-beta.0...v1.0.0)
421

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ You can also pass your own custom scm generator class.
7878

7979
Data generators are the strategies used to generate information about the revision being deployed. A data generator must return an object which contains a property called `revisionKey` which uniquely identifies the current revision. A generator can add any other data that it deems relevant to the data object that it returns.
8080

81-
### File Hash generator
81+
### File Hash generator (`file-hash`)
8282

8383
This generator contructs a revisionKey from the fingerprint of the `index.html` file.
8484

@@ -112,15 +112,15 @@ The list of built project files. This option should be relative to `distDir` and
112112

113113
*Default:* `context.distFiles`
114114

115-
### Git Tag Commit generator
115+
### Git Tag Commit generator (`git-tag-commit`)
116116

117117
Constructs a revision key based on the most recent git tag and the currently checked-out commit.
118118

119119
#### Data fields returned
120120

121121
##### revisionKey
122122

123-
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.
123+
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.
124124

125125
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`.
126126

@@ -130,11 +130,15 @@ The timestamp of the current deploy
130130

131131
#### Configuration Options
132132

133+
##### commitHashLength
134+
135+
The length of the commit hash that is used when constructing the `revisionKey`.
136+
133137
##### separator
134138

135139
The text used to separate the tag name from the commit sha. By default, `+` is used.
136140

137-
### Git Commit generator
141+
### Git Commit generator (`git-commit`)
138142

139143
Constructs a revision key based on the most recent git commit.
140144

@@ -150,6 +154,12 @@ For example, if the current commit is `0993043d49f9e0[...]`, this generator will
150154

151155
The timestamp of the current deploy
152156

157+
#### Configuration Options
158+
159+
##### commitHashLength
160+
161+
The length of the commit hash that is used as the `revisionKey`.
162+
153163
### Version Commit generator
154164

155165
Similar to the Git Tag Commit generator but uses the `package.json` version string to construct the revision key instead of the git tag.
@@ -170,6 +180,10 @@ The timestamp of the current deploy
170180

171181
#### Configuration Options
172182

183+
##### commitHashLength
184+
185+
The length of the commit hash that is used when constructing the `revisionKey`.
186+
173187
##### separator
174188

175189
The text used to separate the tag name from the commit sha. By default, `+` is used.

RELEASE.md

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,60 @@
1-
# Release
1+
# Release Process
22

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

5-
## Steps
7+
## Preparation
68

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

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

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

16-
1. under `Releases` on GitHub choose `Draft New Release`
17-
2. enter the new version number created above as the tag, prefixed with v e.g. (v0.1.12)
18-
3. for release title choose a great name, no pressure.
19-
4. in the description paste the upgrade instructions from the previous release, followed by the new CHANGELOG entry
20-
5. publish the release
27+
## Release
28+
29+
Once the prep work is completed, the actual release is straight forward:
30+
31+
* First, ensure that you have installed your projects dependencies:
32+
33+
```sh
34+
yarn install
35+
```
36+
37+
* Second, ensure that you have obtained a
38+
[GitHub personal access token][generate-token] with the `repo` scope (no
39+
other permissions are needed). Make sure the token is available as the
40+
`GITHUB_AUTH` environment variable.
41+
42+
For instance:
43+
44+
```bash
45+
export GITHUB_AUTH=abc123def456
46+
```
47+
48+
[generate-token]: https://github.com/settings/tokens/new?scopes=repo&description=GITHUB_AUTH+env+variable
49+
50+
* And last (but not least 😁) do your release.
51+
52+
```sh
53+
npx release-it
54+
```
55+
56+
[release-it](https://github.com/release-it/release-it/) manages the actual
57+
release process. It will prompt you to to choose the version number after which
58+
you will have the chance to hand tweak the changelog to be used (for the
59+
`CHANGELOG.md` and GitHub release), then `release-it` continues on to tagging,
60+
pushing the tag and commits, etc.

bin/changelog

Lines changed: 0 additions & 85 deletions
This file was deleted.

index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ module.exports = {
1515
separator: '+',
1616
filePattern: 'index.html',
1717
versionFile: 'package.json',
18+
19+
commitHashLength: function() {
20+
if (this.type === 'git-commit') {
21+
return 7;
22+
} else {
23+
return 8;
24+
}
25+
},
26+
1827
distDir: function(context) {
1928
return context.distDir;
2029
},
@@ -26,7 +35,6 @@ module.exports = {
2635
scm: function(/* context */) {
2736
return require('./lib/scm-data-generators')['git'];
2837
}
29-
3038
},
3139

3240
prepare: function(/*context*/) {

lib/data-generators/git-commit.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@ var gitRepoInfo = require('git-repo-info');
33
var RSVP = require('rsvp');
44

55
module.exports = CoreObject.extend({
6+
init: function(options) {
7+
this._super();
8+
this._plugin = options.plugin;
9+
},
10+
611
generate: function() {
12+
var commitHashLength = this._plugin.readConfig('commitHashLength');
713
var info = gitRepoInfo();
814

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

13-
var sha = info.sha.slice(0, 7);
19+
var sha = info.sha.slice(0, commitHashLength);
1420

1521
if (!sha) {
1622
return RSVP.reject('Could not build revision with commit hash `' + sha + '`');

lib/data-generators/git-tag-commit.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = CoreObject.extend({
99
},
1010

1111
generate: function() {
12+
var commitHashLength = this._plugin.readConfig('commitHashLength');
1213
var separator = this._plugin.readConfig('separator');
1314
var info = gitRepoInfo();
1415

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

1920
var tag = info.lastTag;
20-
var sha = info.sha.slice(0, 8);
21+
var sha = info.sha.slice(0, commitHashLength);
2122

2223
if (!tag || !sha) {
2324
return RSVP.reject('Could not build revision with tag `' + tag + '` and commit hash `' + sha + '`');

lib/data-generators/version-commit.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module.exports = CoreObject.extend({
1313
},
1414

1515
generate: function() {
16+
var commitHashLength = this._plugin.readConfig('commitHashLength');
1617
var separator = this._plugin.readConfig('separator');
1718
var versionFile = this._plugin.readConfig('versionFile');
1819

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

25-
var sha = (info.sha || '').slice(0, 8);
26+
var sha = (info.sha || '').slice(0, commitHashLength);
2627
var plugin = this._plugin;
2728

2829
return readFile(versionFile)

0 commit comments

Comments
 (0)