newspack-scripts 5.9.6 → 5.9.7
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/scripts/github/post-release.sh +2 -2
- package/src/jobs/post-release.yml +1 -1
- package/post-release.sh +0 -73
- package/release-wporg.sh +0 -49
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@ else
|
|
|
35
35
|
else
|
|
36
36
|
echo '[newspack-scripts] Notifying the team on Slack.'
|
|
37
37
|
curl \
|
|
38
|
-
--data "{\"channel\":\"$SLACK_CHANNEL_ID\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"⚠️ Post-release merge to alpha failed for: \`$
|
|
38
|
+
--data "{\"channel\":\"$SLACK_CHANNEL_ID\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"⚠️ Post-release merge to alpha failed for: \`$GITHUB_REPOSITORY\`. Check <$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID|the build> for details.\"}}]}" \
|
|
39
39
|
-H "Content-type: application/json" \
|
|
40
40
|
-H "Authorization: Bearer $SLACK_AUTH_TOKEN" \
|
|
41
41
|
-X POST https://slack.com/api/chat.postMessage \
|
|
@@ -61,7 +61,7 @@ else
|
|
|
61
61
|
else
|
|
62
62
|
echo '[newspack-scripts] Notifying the team on Slack.'
|
|
63
63
|
curl \
|
|
64
|
-
--data "{\"channel\":\"$SLACK_CHANNEL_ID\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"⚠️ Post-release merge to \`trunk\` failed for: \`$
|
|
64
|
+
--data "{\"channel\":\"$SLACK_CHANNEL_ID\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"⚠️ Post-release merge to \`trunk\` failed for: \`$GITHUB_REPOSITORY\`. Check <$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID|the build> for details.\"}}]}" \
|
|
65
65
|
-H "Content-type: application/json" \
|
|
66
66
|
-H "Authorization: Bearer $SLACK_AUTH_TOKEN" \
|
|
67
67
|
-X POST https://slack.com/api/chat.postMessage \
|
package/post-release.sh
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# This script should be ran on CI after a new regular (not pre-release) version is released.
|
|
4
|
-
|
|
5
|
-
git config user.name "$GIT_COMMITTER_NAME"
|
|
6
|
-
git config user.email "$GITHUB_COMMITER_EMAIL"
|
|
7
|
-
|
|
8
|
-
# The last commit message at this point is the automated release commit. The second-to-last
|
|
9
|
-
# commit message should contain data about the merge.
|
|
10
|
-
SECOND_TO_LAST_COMMIT_MSG=$(git log -n 1 --skip 1 --pretty=format:"%s")
|
|
11
|
-
|
|
12
|
-
LATEST_VERSION_TAG=$(git describe --tags --abbrev=0)
|
|
13
|
-
|
|
14
|
-
git pull origin release
|
|
15
|
-
git checkout alpha
|
|
16
|
-
|
|
17
|
-
# If the merge was from alpha branch (the basic flow), alpha branch should be reset.
|
|
18
|
-
if [[ $(echo $SECOND_TO_LAST_COMMIT_MSG | grep '^Merge .*alpha') ]]; then
|
|
19
|
-
echo '[newspack-scripts] Release was created from the alpha branch. Alpha branch will now be reset.'
|
|
20
|
-
|
|
21
|
-
# Reset the tip of alpha branch to the release branch.
|
|
22
|
-
# The alpha branch is single-serving, just for alpha releases. After a release,
|
|
23
|
-
# we don't care about any alpha changes.
|
|
24
|
-
git reset --hard release --
|
|
25
|
-
# Force-push the alpha branch.
|
|
26
|
-
git push "https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git" --force
|
|
27
|
-
else
|
|
28
|
-
echo '[newspack-scripts] Release was created from a different branch than the alpha branch (e.g. a hotfix branch).'
|
|
29
|
-
echo '[newspack-scripts] Alpha branch will now be updated with the lastest changes from release.'
|
|
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
|
|
48
|
-
fi
|
|
49
|
-
|
|
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
|
-
|
|
54
|
-
# Merge release branch into trunk branch, and notify the team if any conflicts arise.
|
|
55
|
-
git merge --no-ff release -m "chore(release): merge in release $LATEST_VERSION_TAG"
|
|
56
|
-
if [[ $? == 0 ]]; then
|
|
57
|
-
echo '[newspack-scripts] Pushing updated trunk to origin.'
|
|
58
|
-
git push "https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git"
|
|
59
|
-
else
|
|
60
|
-
git merge --abort
|
|
61
|
-
echo '[newspack-scripts] Post-release merge to trunk failed.'
|
|
62
|
-
if [ -z "$SLACK_CHANNEL_ID" ] || [ -z "$SLACK_AUTH_TOKEN" ]; then
|
|
63
|
-
echo '[newspack-scripts] Missing Slack channel ID and/or token. Cannot notify.'
|
|
64
|
-
else
|
|
65
|
-
echo '[newspack-scripts] Notifying the team on Slack.'
|
|
66
|
-
curl \
|
|
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
|
-
-H "Content-type: application/json" \
|
|
69
|
-
-H "Authorization: Bearer $SLACK_AUTH_TOKEN" \
|
|
70
|
-
-X POST https://slack.com/api/chat.postMessage \
|
|
71
|
-
-s > /dev/null
|
|
72
|
-
fi
|
|
73
|
-
fi
|
package/release-wporg.sh
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# Release the latest version on wordpress.org plugin repository.
|
|
4
|
-
# To be run as part of CI workflow.
|
|
5
|
-
# Assumptions:
|
|
6
|
-
# - repository name matches the wordpress.org plugin name or WP_ORG_PLUGIN_NAME is set,
|
|
7
|
-
# - there is a `release` directory with the folder containing the files and named as the plugin in it
|
|
8
|
-
# Partially adapted from https://carlalexander.ca/continuous-deployment-wordpress-directory-circleci/
|
|
9
|
-
|
|
10
|
-
SVN_PLUGINS_URL="https://plugins.svn.wordpress.org"
|
|
11
|
-
SVN_REPO_LOCAL_PATH="release/svn"
|
|
12
|
-
WP_ORG_PLUGIN_NAME="${WP_ORG_PLUGIN_NAME:=$CIRCLE_PROJECT_REPONAME}"
|
|
13
|
-
SVN_REPO_URL="$SVN_PLUGINS_URL/$WP_ORG_PLUGIN_NAME"
|
|
14
|
-
|
|
15
|
-
LATEST_GIT_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
|
|
16
|
-
# Remove the "v" at the beginning of the git tag
|
|
17
|
-
LATEST_SVN_TAG=${LATEST_GIT_TAG:1}
|
|
18
|
-
|
|
19
|
-
mkdir -p $SVN_REPO_LOCAL_PATH && cd $SVN_REPO_LOCAL_PATH
|
|
20
|
-
sudo apt-get update
|
|
21
|
-
sudo apt-get install subversion
|
|
22
|
-
|
|
23
|
-
# Check if the latest SVN tag exists already
|
|
24
|
-
TAG=$(svn ls "$SVN_REPO_URL/tags/$LATEST_SVN_TAG")
|
|
25
|
-
error=$?
|
|
26
|
-
if [ $error == 0 ]; then
|
|
27
|
-
# Tag exists, don't deploy
|
|
28
|
-
echo "Latest tag ($LATEST_SVN_TAG) already exists on the WordPress directory. No deployment needed!"
|
|
29
|
-
exit 0
|
|
30
|
-
fi
|
|
31
|
-
|
|
32
|
-
# Wait a moment to avoid a 429 by WPORG's server.
|
|
33
|
-
sleep 3
|
|
34
|
-
|
|
35
|
-
svn checkout -q "$SVN_REPO_URL" .
|
|
36
|
-
|
|
37
|
-
rm -rf trunk
|
|
38
|
-
|
|
39
|
-
cp -r "../$CIRCLE_PROJECT_REPONAME" ./trunk
|
|
40
|
-
cp -r ./trunk "./tags/$LATEST_SVN_TAG"
|
|
41
|
-
|
|
42
|
-
# Add new files to SVN
|
|
43
|
-
svn stat | grep '^?' | awk '{print $2}' | xargs -I x svn add x@
|
|
44
|
-
|
|
45
|
-
# Remove deleted files from SVN
|
|
46
|
-
svn stat | grep '^!' | awk '{print $2}' | xargs -I x svn rm --force x@
|
|
47
|
-
|
|
48
|
-
# Commit to SVN
|
|
49
|
-
svn ci --no-auth-cache --username $WP_ORG_USERNAME --password $WP_ORG_PASSWORD -m "Deploy version $LATEST_SVN_TAG"
|