Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
c3faed17
Unverified
Commit
c3faed17
authored
Feb 01, 2019
by
Robert Knight
Committed by
GitHub
Feb 01, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #911 from hypothesis/remove-changelog
Remove changelog
parents
dce31fdf
d8a29ce8
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
2059 deletions
+39
-2059
CHANGELOG.md
CHANGELOG.md
+0
-1945
Jenkinsfile
Jenkinsfile
+3
-5
package.json
package.json
+1
-1
create-github-release.js
scripts/create-github-release.js
+28
-44
generate-change-list.js
scripts/generate-change-list.js
+1
-2
live-reload-server.js
scripts/gulp/live-reload-server.js
+6
-6
update-changelog.js
scripts/update-changelog.js
+0
-56
No files found.
CHANGELOG.md
deleted
100644 → 0
View file @
dce31fdf
This diff is collapsed.
Click to expand it.
Jenkinsfile
View file @
c3faed17
...
...
@@ -145,16 +145,14 @@ node {
echo https://${env.GITHUB_USERNAME}:${env.GITHUB_TOKEN}@github.com >> \$HOME/.git-credentials
"""
// Fetch information about tags so that changelog generation script
// can produce diff since last tag. Also remove local tags that no
// longer exist on the remote.
// Update local information about tags to match the remote,
// including removing any local tags that no longer exist.
//
// The `--prune-tags` option is not supported in Git 2.11 so we
// use the workaround from https://github.com/git/git/commit/97716d217c1ea00adfc64e4f6bb85c1236d661ff
sh
"git fetch --quiet --prune origin 'refs/tags/*:refs/tags/*' "
// Bump the package version, update the changelog and create the tag
// and GitHub release.
// Bump the package version and create the tag and GitHub release.
sh
"yarn version --new-version ${newPkgVersion}"
// Publish the updated package to the npm registry.
...
...
package.json
View file @
c3faed17
...
...
@@ -147,7 +147,7 @@
"lint"
:
"eslint ."
,
"test"
:
"gulp test"
,
"report-coverage"
:
"codecov -f coverage/coverage-final.json"
,
"version"
:
"make clean build/manifest.json
&& ./scripts/update-changelog.js && git add CHANGELOG.md
"
,
"version"
:
"make clean build/manifest.json"
,
"postversion"
:
"./scripts/postversion.sh"
,
"prepublish"
:
"yarn run build"
}
...
...
scripts/create-github-release.js
View file @
c3faed17
...
...
@@ -9,59 +9,43 @@
* `v<VERSION>` where <VERSION> is the `version` field in package.json.
*/
const
fs
=
require
(
'fs'
);
const
request
=
require
(
'request'
);
const
Octokit
=
require
(
'@octokit/rest'
);
const
pkg
=
require
(
'../package.json'
);
const
{
changelistSinceTag
}
=
require
(
'./generate-change-list'
);
/**
* Extract the release notes for a given version from a markdown changelog in
* the format recommended by http://keepachangelog.com
*/
function
extractReleaseNotes
(
changelog
,
version
)
{
const
notes
=
changelog
.
split
(
/
(\n
|^
)
## /
)
.
find
(
section
=>
section
.
indexOf
(
`[
${
version
}
]`
)
===
0
);
async
function
createGitHubRelease
()
{
// See https://github.com/docker/docker/issues/679
const
GITHUB_ORG_REPO_PAT
=
/^
[
A-Za-z0-9_.-
]
+
\/[
A-Za-z0-9_.-
]
+$/
;
if
(
!
notes
)
{
throw
new
Error
(
`Failed to find release notes for v
${
pkg
.
version
}
`
);
if
(
!
pkg
.
repository
||
!
pkg
.
repository
.
match
(
GITHUB_ORG_REPO_PAT
)
)
{
throw
new
Error
(
'package.json is missing a "repository" field of the form :owner/:repo'
);
}
return
notes
.
split
(
'
\
n'
).
slice
(
1
).
join
(
'
\
n'
);
}
if
(
!
process
.
env
.
GITHUB_TOKEN
)
{
throw
new
Error
(
'GITHUB_TOKEN env var is not set'
);
}
// See https://github.com/docker/docker/issues/679
const
GITHUB_ORG_REPO_PAT
=
/^
[
A-Za-z0-9_.-
]
+
\/[
A-Za-z0-9_.-
]
+$/
;
const
octokit
=
new
Octokit
({
auth
:
`token
${
process
.
env
.
GITHUB_TOKEN
}
`
,
});
if
(
!
pkg
.
repository
||
!
pkg
.
repository
.
match
(
GITHUB_ORG_REPO_PAT
))
{
throw
new
Error
(
'package.json is missing a "repository" field of the form :owner/:repo'
);
}
const
changes
=
await
changelistSinceTag
(
octokit
);
if
(
!
process
.
env
.
GITHUB_TOKEN
)
{
throw
new
Error
(
'GITHUB_TOKEN env var is not set'
);
}
const
[
owner
,
repo
]
=
pkg
.
repository
.
split
(
'/'
);
const
changelog
=
fs
.
readFileSync
(
require
.
resolve
(
'../CHANGELOG.md'
)).
toString
();
const
release
=
{
tag_name
:
`v
${
pkg
.
version
}
`
,
name
:
`v
${
pkg
.
version
}
`
,
body
:
extractReleaseNotes
(
changelog
,
pkg
.
version
),
draft
:
false
,
prerelease
:
true
,
};
await
octokit
.
repos
.
createRelease
({
body
:
changes
,
draft
:
false
,
name
:
`v
${
pkg
.
version
}
`
,
owner
,
prerelease
:
true
,
repo
,
tag_name
:
`v
${
pkg
.
version
}
`
,
});
}
request
.
post
({
uri
:
`https://api.github.com/repos/
${
pkg
.
repository
}
/releases`
,
body
:
release
,
json
:
true
,
headers
:
{
Authorization
:
`token
${
process
.
env
.
GITHUB_TOKEN
}
`
,
'User-Agent'
:
`
${
pkg
.
repository
}
Release Script`
,
},
},
(
err
,
rsp
,
body
)
=>
{
if
(
err
||
rsp
.
statusCode
!==
201
)
{
const
msg
=
err
?
err
.
message
:
`
${
rsp
.
statusCode
}
:
${
JSON
.
stringify
(
body
)}
`
;
throw
new
Error
(
`Creating GitHub release failed:
${
msg
}
`
);
}
console
.
info
(
`Created GitHub release for v
${
pkg
.
version
}
`
);
createGitHubRelease
().
catch
(
err
=>
{
console
.
error
(
'Failed to create release.'
,
err
);
process
.
exit
(
1
);
});
scripts/generate-change-list.js
View file @
c3faed17
...
...
@@ -109,8 +109,7 @@ function formatChangeList(pullRequests) {
}
/**
* Return a markdown-formatted changelog of changes since a given Git tag,
* suitable for inclusion in a CHANGELOG.md file.
* Return a markdown-formatted changelog of changes since a given Git tag.
*
* If no Git tag is specified, default to the most recently created tag.
*
...
...
scripts/gulp/live-reload-server.js
View file @
c3faed17
...
...
@@ -15,8 +15,8 @@ function licenseText() {
return
fs
.
readFileSync
(
'./LICENSE'
,
'utf-8'
);
}
function
c
hangelog
Text
()
{
return
fs
.
readFileSync
(
'./C
HANGELOG.md
'
,
'utf-8'
);
function
c
odeOfConduct
Text
()
{
return
fs
.
readFileSync
(
'./C
ODE_OF_CONDUCT
'
,
'utf-8'
);
}
/**
...
...
@@ -58,15 +58,15 @@ function LiveReloadServer(port, config) {
</body>
</html>
`
;
}
else
if
(
url
.
pathname
===
'/document/c
hangelog
'
)
{
}
else
if
(
url
.
pathname
===
'/document/c
ode_of_conduct
'
)
{
content
=
`
<html>
<head>
<meta charset="UTF-8">
<title>Hypothesis in-line frame document - C
hangelog
</title>
<title>Hypothesis in-line frame document - C
ode of conduct
</title>
</head>
<body>
<pre style="margin: 20px;">
${
c
hangelog
Text
()}
</pre>
<pre style="margin: 20px;">
${
c
odeOfConduct
Text
()}
</pre>
</body>
</html>
`
;
...
...
@@ -120,7 +120,7 @@ function LiveReloadServer(port, config) {
if (!iframeIsAdded) {
var iframe1 = document.querySelector('#iframe1');
var iframeNew = iframe1.cloneNode();
iframeNew.src = "/document/c
hangelog
";
iframeNew.src = "/document/c
ode_of_conduct
";
iframeNew.id = "iframe2";
iframeIsAdded = true;
document.querySelector('#iframe2-container').appendChild(iframeNew);
...
...
scripts/update-changelog.js
deleted
100755 → 0
View file @
dce31fdf
#!/usr/bin/env node
/**
* Replaces the "[Unreleased]" header for changes in the next release with the
* current package version from package.json
*/
'use strict'
;
const
fs
=
require
(
'fs'
);
const
process
=
require
(
'process'
);
const
octokit
=
require
(
'@octokit/rest'
)();
const
pkg
=
require
(
'../package.json'
);
const
{
changelistSinceTag
}
=
require
(
'./generate-change-list'
);
/**
* Update CHANGELOG.md with details of pull requests merged since the previous
* release.
*/
async
function
updateChangeLog
()
{
if
(
process
.
env
.
GITHUB_TOKEN
)
{
octokit
.
authenticate
({
type
:
'oauth'
,
token
:
process
.
env
.
GITHUB_TOKEN
,
});
}
else
{
console
.
warn
(
'GITHUB_TOKEN env var not set. API calls may hit rate limits.'
);
}
const
dateStr
=
new
Date
().
toISOString
().
slice
(
0
,
10
);
const
changelist
=
await
changelistSinceTag
(
octokit
);
const
changelogPath
=
require
.
resolve
(
'../CHANGELOG.md'
);
const
changelog
=
fs
.
readFileSync
(
changelogPath
).
toString
();
const
updatedChangelog
=
changelog
.
replace
(
'# Change Log'
,
`# Change Log
## [
${
pkg
.
version
}
] -
${
dateStr
}
### Changed
${
changelist
}
`
);
fs
.
writeFileSync
(
changelogPath
,
updatedChangelog
);
}
if
(
pkg
.
version
.
includes
(
'-'
))
{
console
.
warn
(
'Skipping changelog update for pre-release version'
);
return
;
}
updateChangeLog
();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment