mirror of
https://github.com/zhigang1992/react-native-notifications.git
synced 2026-01-12 22:50:34 +08:00
Autogenerate changelog using github-release-notes (#382)
* Auto generate changelog * Update .github/main.workflow * Add skip-changelog as a valid PR label
This commit is contained in:
6
.github/main.workflow
vendored
6
.github/main.workflow
vendored
@@ -1,12 +1,12 @@
|
||||
workflow "Verify labels" {
|
||||
on = "pull_request"
|
||||
resolves = "VerifyLabels"
|
||||
resolves = "Enforce PR label"
|
||||
}
|
||||
|
||||
action "VerifyLabels" {
|
||||
action "Enforce PR label" {
|
||||
uses = "yogevbd/enforce-label-action@1.0.0"
|
||||
secrets = ["GITHUB_TOKEN"]
|
||||
env = {
|
||||
VALID_LABELS = "bug,enhancement,feature"
|
||||
VALID_LABELS = "bug,enhancement,feature,skip-changelog"
|
||||
}
|
||||
}
|
||||
28
.grenrc.js
Normal file
28
.grenrc.js
Normal file
@@ -0,0 +1,28 @@
|
||||
module.exports = {
|
||||
template: {
|
||||
commit: ({message, url, author, name}) => `- [${message}](${url}) - ${author ? `@${author}` : name}`,
|
||||
issue: "- {{name}} [{{text}}]({{url}})",
|
||||
label: "[**{{label}}**]",
|
||||
noLabel: "closed",
|
||||
group: "\n#### {{heading}}\n",
|
||||
changelogTitle: "# Changelog\n\n",
|
||||
release: "## {{release}} ({{date}})\n{{body}}",
|
||||
releaseSeparator: "\n---\n\n"
|
||||
},
|
||||
groupBy: {
|
||||
"Enhancements:": ["enhancement", "internal"],
|
||||
"Bug Fixes:": ["bug"],
|
||||
"Features": ["feature"]
|
||||
},
|
||||
ignoreIssuesWith: [
|
||||
"skip-changelog"
|
||||
],
|
||||
ignoreTagsWith: [
|
||||
"snapshot"
|
||||
],
|
||||
dataSource: "prs",
|
||||
changelogFileName: "CHANGELOG.gren.md",
|
||||
tags: "all",
|
||||
override: true,
|
||||
generate: true
|
||||
}
|
||||
@@ -63,7 +63,8 @@
|
||||
"detox": "13.x.x",
|
||||
"jsc-android": "236355.x.x",
|
||||
"jest": "24.8.0",
|
||||
"metro-react-native-babel-preset": "0.55.x"
|
||||
"metro-react-native-babel-preset": "0.55.x",
|
||||
"github-release-notes": "0.17.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
|
||||
@@ -3,7 +3,7 @@ const exec = require('shell-utils').exec;
|
||||
const semver = require('semver');
|
||||
const fs = require('fs');
|
||||
const _ = require('lodash');
|
||||
const path = require('path');
|
||||
const grenrc = require('../.grenrc');
|
||||
|
||||
// Workaround JS
|
||||
const isRelease = process.env.RELEASE_BUILD === 'true';
|
||||
@@ -99,7 +99,7 @@ function tagAndPublish(newVersion) {
|
||||
exec.execSync(`git tag -a ${newVersion} -m "${newVersion}"`);
|
||||
exec.execSyncSilent(`git push deploy ${newVersion} || true`);
|
||||
if (isRelease) {
|
||||
updatePackageJsonGit(newVersion);
|
||||
updateGit(newVersion);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,14 +115,24 @@ function readPackageJson() {
|
||||
return JSON.parse(fs.readFileSync(getPackageJsonPath()));
|
||||
}
|
||||
|
||||
function updatePackageJsonGit(version) {
|
||||
function updateGit(version) {
|
||||
exec.execSync(`git checkout ${BRANCH}`);
|
||||
updatePackageJson(version);
|
||||
generateChangelog();
|
||||
exec.execSync(`git commit -m "Update package.json version to ${version} and generate CHANGELOG.gren.md [ci skip]"`);
|
||||
exec.execSync(`git push deploy ${BRANCH}`);
|
||||
}
|
||||
|
||||
function updatePackageJson(version) {
|
||||
const packageJson = readPackageJson();
|
||||
packageJson.version = version;
|
||||
writePackageJson(packageJson);
|
||||
exec.execSync(`git add package.json`);
|
||||
exec.execSync(`git commit -m"Update package.json version to ${version} [ci skip]"`);
|
||||
exec.execSync(`git push deploy ${BRANCH}`);
|
||||
}
|
||||
|
||||
function generateChangelog() {
|
||||
exec.execSync('gren changelog');
|
||||
exec.execSync(`git add ${grenrc.changelogFileName}`);
|
||||
}
|
||||
|
||||
run();
|
||||
|
||||
Reference in New Issue
Block a user