newspack-scripts 5.1.0 → 5.1.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/post-release.sh +23 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newspack-scripts",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "newspack-scripts": "./bin/newspack-scripts.js"
package/post-release.sh CHANGED
@@ -11,24 +11,40 @@ SECOND_TO_LAST_COMMIT_MSG=$(git log -n 1 --skip 1 --pretty=format:"%s")
11
11
 
12
12
  LATEST_VERSION_TAG=$(git describe --tags --abbrev=0)
13
13
 
14
+ git pull origin release
15
+ git checkout alpha
16
+
14
17
  # If the merge was from alpha branch (the basic flow), alpha branch should be reset.
15
18
  if [[ $(echo $SECOND_TO_LAST_COMMIT_MSG | grep '^Merge .*alpha') ]]; then
16
19
  echo '[newspack-scripts] Release was created from the alpha branch. Alpha branch will now be reset.'
17
20
 
18
21
  # Reset the tip of alpha branch to the release branch.
19
- # The alpha brach is single-serving, just for alpha releases. After a release,
22
+ # The alpha branch is single-serving, just for alpha releases. After a release,
20
23
  # we don't care about any alpha changes.
21
- git pull origin release
22
- git checkout alpha
23
24
  git reset --hard release --
24
25
  # Force-push the alpha branch.
25
26
  git push "https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git" --force
26
27
  else
27
28
  echo '[newspack-scripts] Release was created from a different branch than the alpha branch (e.g. a hotfix branch).'
28
29
  echo '[newspack-scripts] Alpha branch will now be updated with the lastest changes from release.'
29
- git checkout alpha
30
- git merge release --strategy-option=theirs --message="Merge release into alpha"
31
- git push "https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git"
30
+ git merge --no-ff release -m "chore(release): merge in release $LATEST_VERSION_TAG"
31
+ if [[ $? == 0 ]]; then
32
+ git push "https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git"
33
+ else
34
+ git merge --abort
35
+ echo '[newspack-scripts] Post-release merge to alpha failed.'
36
+ if [ -z "$SLACK_CHANNEL_ID" ] || [ -z "$SLACK_AUTH_TOKEN" ]; then
37
+ echo '[newspack-scripts] Missing Slack channel ID and/or token. Cannot notify.'
38
+ else
39
+ echo '[newspack-scripts] Notifying the team on Slack.'
40
+ curl \
41
+ --data "{\"channel\":\"$SLACK_CHANNEL_ID\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"⚠️ Post-release merge to alpha failed for: \`$CIRCLE_PROJECT_REPONAME\`. Check <$CIRCLE_BUILD_URL|the build> for details.\"}}]}" \
42
+ -H "Content-type: application/json" \
43
+ -H "Authorization: Bearer $SLACK_AUTH_TOKEN" \
44
+ -X POST https://slack.com/api/chat.postMessage \
45
+ -s > /dev/null
46
+ fi
47
+ fi
32
48
  fi
33
49
 
34
50
  # Update master branch with latest changes from the release branch, so they are in sync.
@@ -48,7 +64,7 @@ else
48
64
  else
49
65
  echo '[newspack-scripts] Notifying the team on Slack.'
50
66
  curl \
51
- --data "{\"channel\":\"$SLACK_CHANNEL_ID\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"⚠️ Post-release merge 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 master failed for: \`$CIRCLE_PROJECT_REPONAME\`. Check <$CIRCLE_BUILD_URL|the build> for details.\"}}]}" \
52
68
  -H "Content-type: application/json" \
53
69
  -H "Authorization: Bearer $SLACK_AUTH_TOKEN" \
54
70
  -X POST https://slack.com/api/chat.postMessage \