Skip to content

Commit 451026f

Browse files
docs: update changelog (#7004)
1 parent cd66300 commit 451026f

6 files changed

Lines changed: 84 additions & 19 deletions

‎CONTRIBUTING.md‎

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ git checkout -b <my-fix-branch> master
6767

6868
5. Before you submit your PR:
6969
- Rebase your changes to the latest master: `git pull --rebase upstream master`.
70-
- Ensure all unit test are green for Android and iOS. Check [running unit tests](DevelopmentWorkflow.md#running-unit-tests).
70+
- Ensure all unit test are green for Android and iOS. Check [running unit tests](DevelopmentWorkflow.md#running-unit-tests).
7171
- Ensure your changes pass tslint validation. (run `npm run tslint` in the root of the repo).
7272

7373
6. Push your fork. If you have rebased you might have to use force-push your branch:
@@ -223,32 +223,26 @@ Instructions how to release a new version for **NativeScript Core Team Members**
223223
```
224224
git checkout release
225225
```
226-
2. Create a PR to cut the release:
226+
#### If we prepare major or minor release, merge master in release branch else **skip this step**.
227227
```
228-
export RELEASE_VERSION=version
229-
export BRANCH="release-${RELEASE_VERSION}"
230-
git checkout -b ${BRANCH}
231-
git push --set-upstream origin ${BRANCH}
228+
git merge --ff-only origin/master
232229
```
233-
#### Merge master in release branch or cherry-pick commits. If the commits are in release branch **skip this step**.
234-
```
235-
git merge --ff-only origin/master or git cherry-pick commit-sha
236-
git push --set-upstream origin prep-release-version
237-
```
238-
3. Execute `npm i` to install dependencies:
230+
*** Note: If there are commits in release branch which are not merged in master branch '-ff-merge' command will fail.
231+
In this case the commits should be merge firstly from release in master branch as explained in section 'Merge changes from release into master' and then repeat step 1.
232+
233+
2. Execute `npm i` to install dependencies:
239234
```
240235
npm i
241236
```
242-
4. Execute [`npm version`](https://docs.npmjs.com/cli/version) to bump the version of `tns-platform-declarations`:
237+
3. Execute [`npm version`](https://docs.npmjs.com/cli/version) to bump the version of `tns-platform-declarations`:
243238
```
244239
cd tns-platform-declarations
245240
npm --no-git-tag-version version [major|minor|patch] -m "release: cut the %s release"
246241
cd ..
247242
```
248243

249-
5. Execute [`npm version`](https://docs.npmjs.com/cli/version) to bump the version of `tns-core-modules`,
250-
tag the release and update the CHANGELOG.md.
251-
In case we need to publish release version we need simply to use npm version x.x.x-rc
244+
4. Execute [`npm version`](https://docs.npmjs.com/cli/version) to bump the version of `tns-core-modules`,
245+
tag the release and update the CHANGELOG.md. Don't forget to check the auto-generated CHANGELOG.md
252246
```
253247
cd tns-core-modules
254248
npm --no-git-tag-version version [major|minor|patch] -m "release: cut the %s release"
@@ -257,6 +251,11 @@ cd ..
257251
6. Set correct version of **tns-core-modules-widgets** in tns-core-modules/package.json.
258252
Usually tns-core-modules-widgets should already have been released and we need to set the official version.
259253

254+
7. Create release-branch with change log
255+
```
256+
git checkout -b release-[release-version]
257+
```
258+
260259
7. Add changes
261260
```
262261
git add changed-files
@@ -268,13 +267,13 @@ git push
268267
git tag release-version
269268
git push --tags
270269
```
271-
9. Create a pull request. Replace env variables ${RELEASE_VERSION} and ${BRANCH} with their values
270+
9. Create a pull request. Be careful to base your branch on the correct branch
272271
```
273-
curl -d '{"title": "release: cut the ${RELEASE_VERSION} release","body": "docs: update changelog","head": "${BRANCH}","base": "release"}' -X POST https://api.github.com/repos/NativeScript/NativeScript/pulls -H "Authorization: token ${GIT_TOKEN}"
272+
curl -d '{"title": "release: cut the [release-version] release","body": "docs: update changelog","head": "${BRANCH}","base": "release"}' -X POST https://api.github.com/repos/NativeScript/NativeScript/pulls -H "Authorization: token ${GIT_TOKEN}"
274273
```
275274
10. Merge PR into release branch.
276275

277-
11. If all checks has passed publish package.
276+
11. If all checks has passed publish package. Usually the night builds will be triggered and the package will be ready to be released on the next day.
278277

279278
## Merge changes from release into master
280279

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const { readFileSync } = require("fs");
2+
const { resolve } = require("path");
3+
const { createPR, argsParser, gitBranch } = require("./pr-helper");
4+
5+
const currentBranch = argsParser().currentBranch || gitBranch;
6+
const modulesPackageVersion = argsParser().packageVersion || JSON.parse(readFileSync(resolve(process.cwd(), "tns-core-modules/package.json")).toString()).version;
7+
const title = argsParser().title || `release: cut the ${modulesPackageVersion} release`;
8+
const baseBranch = argsParser().base || "release";
9+
const body = argsParser().body || "docs: update changelog";
10+
11+
const postQuery = {
12+
"body": body,
13+
"head": currentBranch,
14+
"base": baseBranch,
15+
"title": title
16+
}
17+
18+
createPR(postQuery);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const { createPR, gitBranch } = require("./pr-helper");
2+
3+
const postQuery = {
4+
"head": gitBranch,
5+
"base": "master",
6+
"title": "chore: merge release in master"
7+
}
8+
9+
createPR(postQuery);

‎build/pr-helper.js‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const { execSync } = require('child_process');
2+
const { writeFileSync, unlinkSync } = require("fs");
3+
const { resolve } = require("path");
4+
5+
exports.gitBranch = execSync("git branch").toString()
6+
.split("\n")
7+
.filter(f => f.trim().startsWith("*"))[0]
8+
.replace("*", "").trim();
9+
10+
exports.createPR = (postQuery) => {
11+
if (!process.env.GIT_TOKEN) {
12+
console.error("Missing env variable GIT_TOKEN");
13+
process.exit(1);
14+
}
15+
const releaseDataJsonPath = resolve(process.cwd(), "git-helper.json");
16+
writeFileSync(releaseDataJsonPath, JSON.stringify(postQuery));
17+
const result = execSync(` curl -d "@${releaseDataJsonPath}" -X POST https://api.github.com/repos/NativeScript/NativeScript/pulls -H "Authorization: token ${process.env.GIT_TOKEN}" `);
18+
console.log(result.toString());
19+
unlinkSync(releaseDataJsonPath);
20+
21+
const requesResultJson = JSON.parse(result);
22+
execSync(`open ${requesResultJson.html_url}`);
23+
24+
return requesResultJson;
25+
}
26+
27+
exports.argsParser = () => {
28+
args = {};
29+
process.argv
30+
.filter(a => a.startsWith("--"))
31+
.map(el => {
32+
el = el.split("=");
33+
const prop = el[0].replace("--", "").replace("-", "").trim();
34+
const value = el[1].trim();
35+
args[prop] = value;
36+
});
37+
38+
return args;
39+
}

‎merge-guidance-schema.png‎

-7.37 KB
Loading
-190 KB
Loading

0 commit comments

Comments
 (0)