Skip to content

Commit

Permalink
chore: Improve release process
Browse files Browse the repository at this point in the history
 - update package.json and plugin.yaml version field during the release process
  • Loading branch information
Arthur Granado committed Apr 17, 2020
1 parent 197d447 commit 47dac16
Show file tree
Hide file tree
Showing 4 changed files with 1,232 additions and 562 deletions.
29 changes: 3 additions & 26 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,9 @@ jobs:
name: Version Check for Semantic Release
command: |
npm install # required here for semantic-release install
npx semantic-release --dry-run --branch ${CIRCLE_BRANCH} > sem-rel-dry-run.txt
echo "semantic-release dry run output:"
cat sem-rel-dry-run.txt
echo "branch: ${CIRCLE_BRANCH}"
if grep "The next release version is" sem-rel-dry-run.txt
then
dry_run_version=$(cat sem-rel-dry-run.txt | grep "The next release version is" | sed -n -e 's/^.*is //p')
echo "semantic-release dry run version: ${dry_run_version}"
plugin_file_version=$(cat plugin.yaml | grep version | sed -n -e 's/^\(version:\) \"\(.*\)\"/\2/p')
echo "Plugin file version: ${plugin_file_version}"
echo "Will fail if ${dry_run_version} does not equal ${plugin_file_version}"
# Fail if the "next" version from the dry-run is not equal to the version specified in the plugin.yaml
test $dry_run_version = $plugin_file_version
elif grep "a new version won’t be published" sem-rel-dry-run.txt
then
echo "version check passes"
elif grep "There are no relevant changes, so no new version is released" sem-rel-dry-run.txt
then
echo "version check passes"
else
# failing here this will help us detect new/changed/unanticipated log messages/scenarios from semantic-release
echo "unknown semantic-release dry-run state - failing"
exit 1
fi
next_version=$(npx semantic-release --branch ${CIRCLE_BRANCH} --dry-run | grep "The next release version is" | sed -n -e 's/^.*is //p')
sed -i "s/version.*/version: \"${next_version}\"/g" plugin.yaml
npx semantic-release --branch ${CIRCLE_BRANCH}
release:
docker:
- image: circleci/node:lts
Expand Down
12 changes: 10 additions & 2 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
{
"branches": [
"master"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/exec"
"@semantic-release/changelog",
["@semantic-release/npm", {
"npmPublish": false
}],
["@semantic-release/git", {
"assets": ['CHANGELOG.md', 'package.json', 'package-lock.json', "plugin.yaml"]
}]
],
"publish": [
"@semantic-release/npm",
Expand Down
Loading

0 comments on commit 47dac16

Please sign in to comment.