Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use semantic-release for releases #829

Merged
merged 9 commits into from
Sep 7, 2023
Merged

Conversation

reakaleek
Copy link
Member

@reakaleek reakaleek commented Sep 5, 2023

Details

This change utilises semantic-release for releasing.

semantic-release does not support providing OTP by default. This is the reason why we are disabling the npmPublish option in the @semantic-release/npm plugin. Instead, we are using the @semantic-release/exec plugin to run the publish command on our own.

How to test

git checkout main
git merge feature/semantic-release

export GITHUB_TOKEN=$(gh auth token)

npx semantic-release --dry-run --no-ci
log output
npx semantic-release --dry-run --no-ci
[5:27:32 PM] [semantic-release] › ℹ  Running semantic-release version 21.1.1
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/npm"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/exec"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/github"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/exec"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "verifyRelease" from "@semantic-release/exec"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/exec"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/npm"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/exec"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/npm"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/exec"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/github"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/npm"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/exec"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/github"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/exec"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/github"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/exec"
[5:27:32 PM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/github"
[5:27:40 PM] [semantic-release] › ⚠  Run automated release from branch main on repository [email protected]:reakaleek/synthetics.git in dry-run mode
[5:27:42 PM] [semantic-release] › ✔  Allowed to push to the Git repository
[5:27:42 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/npm"
[5:27:42 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/npm"
[5:27:42 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/exec"
[5:27:42 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/exec"
[5:27:42 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/github"
[5:27:42 PM] [semantic-release] [@semantic-release/github] › ℹ  Verify GitHub authentication
[5:27:42 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/github"
[5:27:42 PM] [semantic-release] › ℹ  Found git tag v1.4.0 associated with version 1.4.0 on branch main
[5:27:42 PM] [semantic-release] › ℹ  Found 12 commits since last release
[5:27:42 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Fix dry-run
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Add documentation about the versioning
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Add previous behavior of dist-tags again
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: fix
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: test
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: test
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Use semantic-release for releases
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: ci: check pr title with commitlint (#828)

* Add workflow to lint PR title on PRs

* Install necessary packages for commitlint permanently

* Trigger workflow only if the target branch is main

* test

* Revert "test"

This reverts commit fb6e0e8dd90ca4926ec8c382058b76eb5be835d3.
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: fix: fix dry run for base reporter (#827)
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The release type for the commit is patch
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: feat: bundle expect from @playwright/test library (#812)

* feat: bundle expect from pw/test library

* remove jest expect

* bundle expect library correctly

* fix build script

* fix lint

* add expect tests

* throw error for non supported assertions

* update

* test and improve err msg

---------

Co-authored-by: shahzad31 <[email protected]>
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The release type for the commit is minor
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: fix: Throw better error message if version parsing fails (#821)

* Throw better error message if version parsing fails.

* Cleaner fix.

* Update targeted HTTP endpoint.

* Add dummy server route for new endpoint.
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The release type for the commit is patch
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: feat: collect logs for successful journey as well (#817)

* PR feedback

* revert

* update

* add tests and fix algo

* Update src/plugins/browser-console.ts

* Update src/plugins/browser-console.ts

---------

Co-authored-by: vigneshshanmugam <[email protected]>
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The release type for the commit is minor
[5:27:42 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analysis of 12 commits complete: minor release
[5:27:42 PM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[5:27:42 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/exec"
[5:27:42 PM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/exec"
[5:27:42 PM] [semantic-release] › ℹ  The next release version is 1.5.0
[5:27:42 PM] [semantic-release] › ℹ  Start step "verifyRelease" of plugin "@semantic-release/exec"
[5:27:42 PM] [semantic-release] › ✔  Completed step "verifyRelease" of plugin "@semantic-release/exec"
[5:27:42 PM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[5:27:42 PM] [semantic-release] › ✔  Completed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[5:27:42 PM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "@semantic-release/exec"
[5:27:42 PM] [semantic-release] › ✔  Completed step "generateNotes" of plugin "@semantic-release/exec"
[5:27:42 PM] [semantic-release] › ⚠  Skip step "prepare" of plugin "@semantic-release/npm" in dry-run mode
[5:27:42 PM] [semantic-release] › ⚠  Skip step "prepare" of plugin "@semantic-release/exec" in dry-run mode
[5:27:42 PM] [semantic-release] › ⚠  Skip v1.5.0 tag creation in dry-run mode
[5:27:42 PM] [semantic-release] › ⚠  Skip step "publish" of plugin "@semantic-release/npm" in dry-run mode
[5:27:42 PM] [semantic-release] › ⚠  Skip step "publish" of plugin "@semantic-release/exec" in dry-run mode
[5:27:42 PM] [semantic-release] › ⚠  Skip step "publish" of plugin "@semantic-release/github" in dry-run mode
[5:27:42 PM] [semantic-release] › ⚠  Skip step "success" of plugin "@semantic-release/exec" in dry-run mode
[5:27:42 PM] [semantic-release] › ⚠  Skip step "success" of plugin "@semantic-release/github" in dry-run mode
[5:27:42 PM] [semantic-release] › ✔  Published release 1.5.0 on default channel
[5:27:42 PM] [semantic-release] › ℹ  Release note for version 1.5.0:
marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`.
marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install  https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`.
# 1.5.0 (https://github.com/reakaleek/synthetics/compare/v1.4.0...v1.5.0) (2023-09-07)

### Bug Fixes

    * fix dry run for base reporter (#827 (https://github.com/reakaleek/synthetics/issues/827)) (839cfea (https://github.com/reakaleek/synthetics/commit/839cfeaa016fd35a092d2433d871d872d09e6dbd))
    * Throw better error message if version parsing fails (#821 (https://github.com/reakaleek/synthetics/issues/821)) (f585818 (https://github.com/reakaleek/synthetics/commit/f58581823e4b6604ae67f4455049f89010b80741))

### Features

    * bundle expect from @playwright/test library (#812 (https://github.com/reakaleek/synthetics/issues/812)) (044a94e (https://github.com/reakaleek/synthetics/commit/044a94e3b9d586552426da8a054e964786e7f23a))
    * collect logs for successful journey as well (#817 (https://github.com/reakaleek/synthetics/issues/817)) (3c37260 (https://github.com/reakaleek/synthetics/commit/3c37260724aa53ba2cf585ce8900bb6f857458a0))

jcal@Jan’s-MacBook-Pro synthetics % 

@reakaleek reakaleek changed the title Use semantic-release for releases ci: use semantic-release for releases Sep 5, 2023
@reakaleek reakaleek force-pushed the feature/semantic-release branch 3 times, most recently from 97c6069 to 4d6c6e2 Compare September 6, 2023 21:08
@reakaleek reakaleek requested review from vigneshshanmugam and a team September 7, 2023 09:53
@reakaleek reakaleek marked this pull request as ready for review September 7, 2023 10:02
@reakaleek reakaleek self-assigned this Sep 7, 2023
.github/workflows/release.yml Show resolved Hide resolved
package.json Show resolved Hide resolved
.github/workflows/release.yml Show resolved Hide resolved
@@ -151,6 +151,11 @@ The release process is also automated in the way any specific commit from the ma
1. Click the green `Run workflow` button to trigger the release workflow.
1. Then you can go to the `https://www.npmjs.com/package/@elastic/synthetics` to validate that the bundles have been published.

#### Versioning
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does it pick the existing versioning if we set it to 0-0-0 in the package JSON, are we doing it based on existing tags?

Also can you post a dry-run output? I am not able to run it localy.

Copy link
Member Author

@reakaleek reakaleek Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it's based on existing tags.

Will post the log output in a couple of minutes. I will also add a how to test section in the description.

Copy link
Member Author

@reakaleek reakaleek Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I justed added the "How to test section". The log output can be found in the collapsible details.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is something wrong with this file, Could you wipe it off and generate a new one by using the same node version?

nvm use && npm i

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.releaserc Outdated
[
"@semantic-release/npm",
{
"npmPublish": false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"npmPublish": false,
"npmPublish": false

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@vigneshshanmugam vigneshshanmugam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@reakaleek reakaleek merged commit b8a7b1f into main Sep 7, 2023
6 checks passed
@reakaleek reakaleek deleted the feature/semantic-release branch September 7, 2023 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants