newspack-scripts 2.0.0 → 3.0.0-alpha.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newspack-scripts",
3
- "version": "2.0.0",
3
+ "version": "3.0.0-alpha.3",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "newspack-scripts": "./bin/newspack-scripts.js"
package/post-release.sh CHANGED
@@ -3,19 +3,31 @@
3
3
  git config user.name "$GIT_COMMITTER_NAME"
4
4
  git config user.email "$GITHUB_COMMITER_EMAIL"
5
5
 
6
- # Reset the tip of alpha branch to the release branch.
7
- # The alpha brach is single-serving, just for alpha releases. After a release,
8
- # we don't care about any alpha changes.
9
- git pull origin release
10
- git checkout alpha
11
- git reset --hard release --
12
- git push "https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git" --force
6
+ # The last commit message at this point is the automated release commit. The second-to-last
7
+ # commit message should contain data about the merge.
8
+ SECOND_TO_LAST_COMMIT_MSG=$(git log -n 1 --skip 1 --pretty=format:"%s")
13
9
 
14
- # Cherry-pick the latest commit from the release branch onto the master branch.
15
- # This way the version numbers and the changelog on master are up to date.
16
- #
17
- # Note that this will fail if there is no CHANGELOG.md on master - in such case the cherry-pick will
18
- # result in a conflict.
10
+ LATEST_VERSION_TAG=$(git describe --tags --abbrev=0)
11
+
12
+ # If the merge was from alpha branch, alpha branch should be reset.
13
+ if [[ $(echo $SECOND_TO_LAST_COMMIT_MSG | grep '^Merge pull request.*alpha') ]]; then
14
+ echo '[newspack-scripts] Release was created from the alpha branch. Alpha branch will now be reset.'
15
+
16
+ # Reset the tip of alpha branch to the release branch.
17
+ # The alpha brach is single-serving, just for alpha releases. After a release,
18
+ # we don't care about any alpha changes.
19
+ git pull origin release
20
+ git checkout alpha
21
+ git reset --hard release --
22
+ # Force-push the alpha branch.
23
+ git push "https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git" --force
24
+ fi
25
+
26
+ # Update master branch with latest changes from the release branch, so they are in sync.
27
+ echo '[newspack-scripts] Merging the release branch into master'
19
28
  git checkout master
20
- git cherry-pick $(git rev-parse release) --strategy-option theirs
29
+ # Merge release branch into master branch, prefering the changes from release branch if conflicts arise.
30
+ git merge --squash release --strategy-option=theirs
31
+ git commit --message "chore(release): merge in release $LATEST_VERSION_TAG"
32
+ # Push updated master upstream.
21
33
  git push "https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git"
@@ -19,11 +19,18 @@ const config = {
19
19
  debug: semanticReleaseArgs.debug,
20
20
 
21
21
  branches: [
22
+ // `release` branch is published on the main distribution channel (a new version on GH).
22
23
  "release",
24
+ // `alpha` branch – for regular pre-releases.
23
25
  {
24
26
  name: "alpha",
25
27
  prerelease: "alpha",
26
28
  },
29
+ // `hotfix/*` branches – for releases outside of the release schedule.
30
+ {
31
+ name: "hotfix/*",
32
+ prerelease: "hotfix",
33
+ },
27
34
  ],
28
35
  prepare: [
29
36
  "@semantic-release/changelog",