-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
breaking: re-setup due to repository transfer (#39)
- Loading branch information
Showing
11 changed files
with
2,796 additions
and
1,823 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Release | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') | ||
runs-on: Ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
registry-url: "https://registry.npmjs.org" | ||
- run: git switch master | ||
- run: | | ||
if [ -f "yarn.lock" ]; then | ||
yarn install | ||
else | ||
npm install | ||
fi | ||
- run: npm run release:trigger | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | ||
SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": [ | ||
"config:base", | ||
":preserveSemverRanges" | ||
], | ||
"labels": ["Type: Dependency"], | ||
"automerge": true, | ||
"major": { | ||
"automerge": false | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
const execa = require(require.resolve('execa')) | ||
const { promisify } = require('util') | ||
const fs = require('fs') | ||
const path = require('path') | ||
const read = promisify(fs.readFile) | ||
const write = fs.writeFileSync | ||
|
||
function extractSpecificChangelog (changelog, version) { | ||
if (!changelog) { | ||
return null | ||
} | ||
const escapedVersion = version.replace(/\./g, '\\.') | ||
const regex = new RegExp( | ||
`(#+?\\s\\[?v?${escapedVersion}\\]?[\\s\\S]*?)(#+?\\s\\[?v?\\d+?\\.\\d+?\\.\\d+?\\]?)`, | ||
'g' | ||
) | ||
const matches = regex.exec(changelog) | ||
return matches ? matches[1] : null | ||
} | ||
|
||
async function commitChangelog (current, next) { | ||
const { stdout } = await execa('npx', ['lerna-changelog', '--next-version', `v${next}`]) | ||
const escapedVersion = next.replace(/\./g, '\\.') | ||
const regex = new RegExp( | ||
`(#+?\\s\\[?v?${escapedVersion}\\]?[\\s\\S]*?)(#+?\\s\\[?v?\\d\\.\\d\\.\\d\\]?)`, | ||
'g' | ||
) | ||
const matches = regex.exec(stdout.toString()) | ||
const head = matches ? matches[1] : stdout | ||
const changelog = await read('./CHANGELOG.md', 'utf8') | ||
return write('./CHANGELOG.md', `${head}\n\n${changelog}`) | ||
} | ||
|
||
module.exports = { | ||
mergeStrategy: { toSameBranch: ['master'] }, | ||
monorepo: undefined, | ||
updateChangelog: false, | ||
beforeCommitChanges: ({ nextVersion, exec, dir }) => { | ||
return new Promise(resolve => { | ||
const pkg = require('./package.json') | ||
commitChangelog(pkg.version, nextVersion).then(resolve) | ||
}) | ||
}, | ||
formatCommitMessage: ({ | ||
version, | ||
releaseType, | ||
mergeStrategy, | ||
baseBranch | ||
}) => `${releaseType} release v${version}`, | ||
formatPullRequestTitle: ({ | ||
version, | ||
releaseType | ||
}) => `${releaseType} release v${version}`, | ||
shouldRelease: () => true, | ||
releases: { | ||
extractChangelog: ({ version, dir }) => { | ||
const changelogPath = path.resolve(dir, 'CHANGELOG.md') | ||
try { | ||
const changelogFile = fs.readFileSync(changelogPath, 'utf-8').toString() | ||
const ret = extractSpecificChangelog(changelogFile, version) | ||
return ret | ||
} catch (err) { | ||
if (err.code === 'ENOENT') { | ||
return null | ||
} | ||
throw err | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.