newspack-scripts 5.2.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  ### All Submissions:
2
2
 
3
- * [ ] Have you followed the [Newspack Contributing guideline](https://github.com/Automattic/newspack-theme/blob/master/.github/CONTRIBUTING.md)?
3
+ * [ ] Have you followed the [Newspack Contributing guideline](https://github.com/Automattic/newspack-theme/blob/trunk/.github/CONTRIBUTING.md)?
4
4
  * [ ] Have you checked to ensure there aren't other open [Pull Requests](../../pulls) for the same update/change?
5
5
 
6
6
  <!-- Mark completed items with an [x] -->
package/README.md CHANGED
@@ -53,30 +53,51 @@ Will validate TypeScript code in the project. This requires a `tsconfig.json` fi
53
53
 
54
54
  This package contains a configuration of [`semantic-release`](semantic-release.gitbook.io/), which can be used for automated software releases, published on Github. It's configured to work with the following repository branch setup:
55
55
 
56
- 1. `master` – ongoing development
56
+ 1. `trunk` – ongoing development
57
57
  1. `alpha` – release candidate
58
+ 1. `hotfix/*` - for testing urgent bugfixes
59
+ 1. `epic/*` - for testing large-scale features
58
60
  1. `release` – the production-ready, released code
59
61
 
60
62
  The following assumes that CI will run:
61
63
 
62
- 1. `npm run release` for `release`, `alpha`, and `hotfix/*` branches
64
+ 1. `npm run release` for `release`, `alpha`, `hotfix/*`, and `epic/*` branches
63
65
  1. `post-release.sh` script on `release` branch, after the above command completes
64
66
 
65
67
  ### Regular release flow
66
68
 
67
- 1. Commit ongoing changes to `master` branch, using [structured commit messages](https://www.conventionalcommits.org/en/v1.0.0/)
68
- 1. Merge `master` into `alpha` to create a release candidate (e.g. `1.2.0-alpha.1`)
69
- 1. Merge `alpha` into `release` to create a release (e.g. `1.2.0`)
70
- 1. `alpha` branch will be reset on top of `release`
71
- 1. `master` branch will be updated with the changes from the `release` branch
69
+ 1. Create a new branch off the `trunk` branch.
70
+ 1. Commit changes to your branch using [structured commit messages](https://www.conventionalcommits.org/en/v1.0.0/).
71
+ 1. Open a pull request for review based on `trunk`. Changes must be tested and approved before merging.
72
+ 1. Merge approved changes to the `trunk` branch. When merging into `trunk`, SQUASH the merge.
73
+ 1. Merge `trunk` into `alpha` to create a release candidate (e.g. `1.2.0-alpha.1`). When merging `trunk` into `alpha`, DO NOT SQUASH the merge.
74
+ 1. Merge `alpha` into `release` to create a production release (e.g. `1.2.0`). When merging `alpha` into `release`, DO NOT SQUASH the merge.
75
+ 1. `alpha` branch will be reset on top of `release`.
76
+ 1. `trunk` branch will be updated with the changes from the `release` branch.
77
+
78
+ ### Epic feature release flow
79
+
80
+ For large-scale features that require more than one interdependent branch throughout development.
81
+
82
+ 1. Create a new `epic/*` branch off the `trunk` branch. Push the branch to GitHub so all engineers can work off it simultaneously. **Keep this branch up-to-date with `trunk`, to minimize the risk of merge conflicts.**
83
+ 1. Create new sub-branches off the epic branch. **Keep sub-branches up-to-date with the `epic/*` branch, to minimize the risk of merge conflicts.**
84
+ 1. Commit changes to your sub-branches using [structured commit messages](https://www.conventionalcommits.org/en/v1.0.0/).
85
+ 1. Open pull requests for review based on the `epic/*` branch. Changes must be tested and approved before merging.
86
+ 1. Merge approved changes to the `epic/*` branch. When merging into `epic/*`, DO NOT SQUASH the merge.
87
+ 1. A new "epic" pre-release (e.g. `1.2.0-epic-feature.1`) will be tagged and published when changes are merged via PR. Use epic releases for QA and other pre-release testing.
88
+ 1. Once all features in the `epic/*` branch have been tested and approved, open a pull request for final review based on `trunk`. Final review doesn't require full-scale functional testing, only a review of the changeset (as changes have already been tested in individual PRs).
89
+ 1. Merge the `epic/*` branch to the `trunk` branch. When merging an epic branch into `trunk`, SQUASH the merge.
90
+ 1. Once `epic/*` has been merged to `trunk`, follow the regular release flow to generate release candidates and production releases.
72
91
 
73
92
  ### Hotfix release flow
74
93
 
75
- 1. Create a new `hotfix/*` branch off the `release` branch
94
+ 1. Create a new `hotfix/*` branch off the `release` branch.
95
+ 1. Commit changes to your branch using [structured commit messages](https://www.conventionalcommits.org/en/v1.0.0/).
76
96
  1. Push the branch to Github, so the CI can process it – _don't create a PR just yet!\*_
77
- 1. A new "hotfix" pre-release (e.g. `1.2.0-hotfix.1`) will be published
78
- 1. Merge the hotfix branch into `release` to create a release
79
- 1. `alpha` & `master` branches will be updated with the changes from the `release` branch
97
+ 1. A new "hotfix" pre-release (e.g. `1.2.0-hotfix.1`) will be tagged and published.
98
+ 1. Open a pull request for review based on `release`. Changes must be tested and approved before merging.
99
+ 1. Merge the hotfix branch into `release` to create a release. When merging a hotfix into `release`, SQUASH the merge.
100
+ 1. `alpha` & `trunk` branches will be updated with the changes from the `release` branch.
80
101
 
81
102
  \* `semantic-release` [will not release if the CI job was triggered by a PR](https://github.com/semantic-release/semantic-release/blob/971a5e0d16f1a32e117e9ce382a1618c8256d0d9/index.js#L48-L51)
82
103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newspack-scripts",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "newspack-scripts": "./bin/newspack-scripts.js"
package/post-release.sh CHANGED
@@ -47,24 +47,24 @@ else
47
47
  fi
48
48
  fi
49
49
 
50
- # Update master branch with latest changes from the release branch, so they are in sync.
51
- echo '[newspack-scripts] Merging the release branch into master.'
52
- git checkout master
50
+ # Update trunk branch with latest changes from the release branch, so they are in sync.
51
+ echo '[newspack-scripts] Merging the release branch into trunk.'
52
+ git checkout trunk
53
53
 
54
- # Merge release branch into master branch, and notify the team if any conflicts arise.
54
+ # Merge release branch into trunk branch, and notify the team if any conflicts arise.
55
55
  git merge --no-ff release -m "chore(release): merge in release $LATEST_VERSION_TAG"
56
56
  if [[ $? == 0 ]]; then
57
- echo '[newspack-scripts] Pushing updated master to origin.'
57
+ echo '[newspack-scripts] Pushing updated trunk to origin.'
58
58
  git push "https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git"
59
59
  else
60
60
  git merge --abort
61
- echo '[newspack-scripts] Post-release merge to master failed.'
61
+ echo '[newspack-scripts] Post-release merge to trunk failed.'
62
62
  if [ -z "$SLACK_CHANNEL_ID" ] || [ -z "$SLACK_AUTH_TOKEN" ]; then
63
63
  echo '[newspack-scripts] Missing Slack channel ID and/or token. Cannot notify.'
64
64
  else
65
65
  echo '[newspack-scripts] Notifying the team on Slack.'
66
66
  curl \
67
- --data "{\"channel\":\"$SLACK_CHANNEL_ID\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"⚠️ Post-release merge to master failed for: \`$CIRCLE_PROJECT_REPONAME\`. Check <$CIRCLE_BUILD_URL|the build> for details.\"}}]}" \
67
+ --data "{\"channel\":\"$SLACK_CHANNEL_ID\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"⚠️ Post-release merge to \`trunk\` failed for: \`$CIRCLE_PROJECT_REPONAME\`. Check <$CIRCLE_BUILD_URL|the build> for details.\"}}]}" \
68
68
  -H "Content-type: application/json" \
69
69
  -H "Authorization: Bearer $SLACK_AUTH_TOKEN" \
70
70
  -X POST https://slack.com/api/chat.postMessage \
@@ -41,6 +41,13 @@ const getConfig = ({ gitBranchName }) => {
41
41
  // is not valid, though. See https://semver.org/#spec-item-9.
42
42
  prerelease: '${name.replace(/\\//g, "-")}',
43
43
  },
44
+ // `epic/*` branches – for beta testing/QA pre-release builds.
45
+ {
46
+ name: "epic/*",
47
+ // With `prerelease: true`, the `name` would be used for the pre-release tag. A name with a `/`
48
+ // is not valid, though. See https://semver.org/#spec-item-9.
49
+ prerelease: '${name.replace(/\\//g, "-")}',
50
+ },
44
51
  ],
45
52
  prepare: ["@semantic-release/changelog", "@semantic-release/npm"],
46
53
  plugins: [
@@ -69,17 +76,19 @@ const getConfig = ({ gitBranchName }) => {
69
76
  ],
70
77
  };
71
78
 
72
- // Unless on a hotfix branch, add a commit that updates the files.
73
- if (gitBranchName.indexOf("hotfix/") !== 0) {
79
+ // Bump the semver and prepare a build package.
80
+ config.prepare.push([
81
+ // Increment the version in additional files, and the create the release archive.
82
+ "semantic-release-version-bump",
83
+ {
84
+ files: filesList,
85
+ callback: "npm run release:archive",
86
+ },
87
+ ]);
88
+
89
+ // Unless on a hotfix or epic branch, add a commit that updates the files.
90
+ if (gitBranchName.indexOf("hotfix/") !== 0 && gitBranchName.indexOf("epic/") !== 0) {
74
91
  utils.log(`Plugin files and the changelog will be updated.`);
75
- config.prepare.push([
76
- // Increment the version in additional files, and the create the release archive.
77
- "semantic-release-version-bump",
78
- {
79
- files: filesList,
80
- callback: "npm run release:archive",
81
- },
82
- ]);
83
92
  config.prepare.push({
84
93
  path: "@semantic-release/git",
85
94
  // These assets should be added to source control after a release.
@@ -93,8 +102,9 @@ const getConfig = ({ gitBranchName }) => {
93
102
  "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
94
103
  });
95
104
  } else {
105
+ const branchType = gitBranchName.indexOf("hotfix/") === 0 ? 'hotfix' : 'epic';
96
106
  utils.log(
97
- `This is a hotfix branch, plugin files and the changelog will *not* be updated.`
107
+ `This is a ${branchType} branch, plugin files and the changelog will *not* be updated.`
98
108
  );
99
109
  }
100
110
 
package/scripts/test.js CHANGED
@@ -22,8 +22,8 @@ const JEST_CONFIG = {
22
22
  },
23
23
  transformIgnorePatterns: [
24
24
  // Ignore all node_modules except for newspack-scripts, @wordpress/* packages, and
25
- // a @wordpress/data dependency which distributes an ES6 module.
26
- "/node_modules/(?!(newspack-scripts|@wordpress|is-plain-obj)/)",
25
+ // some transitive dependencies which distribute ES6 modules.
26
+ "/node_modules/(?!(newspack-scripts|@wordpress|is-plain-obj|memize)/)",
27
27
  ],
28
28
  moduleNameMapper: {
29
29
  "\\.(scss|css)$": path.resolve(__dirname, "utils/babelJestTransformer.js"),
package/src/@orb.yml CHANGED
@@ -4,5 +4,5 @@ description: >
4
4
  Newspack shared CI config.
5
5
 
6
6
  display:
7
- home_url: "https://newspack.pub"
7
+ home_url: "https://newspack.com"
8
8
  source_url: "https://www.github.com/Automattic/newspack-scripts"