newspack-scripts 3.0.0-alpha.2 → 3.0.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.
- package/package.json +1 -1
- package/post-release.sh +12 -3
package/package.json
CHANGED
package/post-release.sh
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
+
# This script should be ran on CI after a new regular (not pre-release) version is released.
|
|
4
|
+
|
|
3
5
|
git config user.name "$GIT_COMMITTER_NAME"
|
|
4
6
|
git config user.email "$GITHUB_COMMITER_EMAIL"
|
|
5
7
|
|
|
@@ -9,8 +11,8 @@ SECOND_TO_LAST_COMMIT_MSG=$(git log -n 1 --skip 1 --pretty=format:"%s")
|
|
|
9
11
|
|
|
10
12
|
LATEST_VERSION_TAG=$(git describe --tags --abbrev=0)
|
|
11
13
|
|
|
12
|
-
# If the merge was from alpha branch, alpha branch should be reset.
|
|
13
|
-
if [[ $(echo $SECOND_TO_LAST_COMMIT_MSG | grep '^Merge
|
|
14
|
+
# If the merge was from alpha branch (the basic flow), alpha branch should be reset.
|
|
15
|
+
if [[ $(echo $SECOND_TO_LAST_COMMIT_MSG | grep '^Merge .*alpha') ]]; then
|
|
14
16
|
echo '[newspack-scripts] Release was created from the alpha branch. Alpha branch will now be reset.'
|
|
15
17
|
|
|
16
18
|
# Reset the tip of alpha branch to the release branch.
|
|
@@ -21,12 +23,19 @@ if [[ $(echo $SECOND_TO_LAST_COMMIT_MSG | grep '^Merge pull request.*alpha') ]];
|
|
|
21
23
|
git reset --hard release --
|
|
22
24
|
# Force-push the alpha branch.
|
|
23
25
|
git push "https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git" --force
|
|
26
|
+
else
|
|
27
|
+
echo '[newspack-scripts] Release was created from a different branch than the alpha branch (e.g. a hotfix branch).'
|
|
28
|
+
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"
|
|
24
32
|
fi
|
|
25
33
|
|
|
26
34
|
# Update master branch with latest changes from the release branch, so they are in sync.
|
|
27
35
|
echo '[newspack-scripts] Merging the release branch into master'
|
|
28
36
|
git checkout master
|
|
29
|
-
|
|
37
|
+
# Merge release branch into master branch, prefering the changes from release branch if conflicts arise.
|
|
38
|
+
git merge --squash release --strategy-option=theirs
|
|
30
39
|
git commit --message "chore(release): merge in release $LATEST_VERSION_TAG"
|
|
31
40
|
# Push updated master upstream.
|
|
32
41
|
git push "https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git"
|