Skip to content

Conversation

abernier
Copy link
Collaborator

@abernier abernier commented Feb 10, 2023

  • localhost Verdaccio publish

    • @yomotsu has reproduced
    • test the resulting package in a working/existing project:
      $ npm i camera-controls --registry=http://localhost:4873
  • Test the release .github/workflow in Actions -- on Github Packages registry (not to conflict with npm registry)

    • @yomotsu has reproduced
    • test the resulting package in a working/existing project:
      $ npm i @yomotsu/camera-controls --registry=https://npm.pkg.github.com
  • Integrate doc generation to the github-action workflow

  • Once everything is tested, change some values (cf. comments) and delete tests-related files


Verdaccio (local registry)

To test it on your localhost:

  1. Create a new local semantic-release branch from dev
    $ git checkout dev
    $ git checkout -b semantic-release
  2. Pull this PR branch into:
    $ git remote add abernier https://github.com/abernier/camera-controls.git
    $ git pull abernier semantic-release
  3. Push to a remote yomotsu:semantic-release branch:
   $ git push origin semantic-release # because a remote branch should exist for semantic-release to compare against
  1. Launch a local npm registry:
    $ npx -y verdaccio --config tmp/verdaccio-config.yml
  2. Create a Github PAT with following permissions to the repo:
    • contents: write
    • issues: write
    • pull-requests: write
  3. Try a release (on your local Verdaccio registry):
    $ export NPM_TOKEN=1234 # whatever, it is fake
    $ export GITHUB_TOKEN=github_pat_XXXXXXX # not fake this one!
    
    $ npm run release -- --ci false
    
    > [email protected] release
    > semantic-release --repository-url abernier/camera-controls --ci false
    
    [7:30:07 PM] [semantic-release] › ℹ  Running semantic-release version 20.1.0
    [7:30:07 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/npm"
    [7:30:07 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/github"
    [7:30:07 PM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
    [7:30:07 PM] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
    [7:30:07 PM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/npm"
    [7:30:07 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/npm"
    [7:30:07 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/github"
    [7:30:07 PM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/npm"
    [7:30:07 PM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/github"
    [7:30:07 PM] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/github"
    [7:30:07 PM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/github"
    [7:30:10 PM] [semantic-release] › ✔  Run automated release from branch semantic-release on repository abernier/camera-controls
    [7:30:11 PM] [semantic-release] › ✔  Allowed to push to the Git repository
    [7:30:11 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/npm"
    [7:30:11 PM] [semantic-release] [@semantic-release/npm] › ℹ  Verify authentication for registry http://localhost:4873/
    [7:30:11 PM] [semantic-release] [@semantic-release/npm] › ℹ  Reading npm config from /Users/abernier/.npmrc, /Users/abernier/Sites/camera-controls/.npmrc
    [7:30:11 PM] [semantic-release] [@semantic-release/npm] › ℹ  Wrote NPM_TOKEN to /private/var/folders/jq/v82th6qx7j37zztbbts071v80000gn/T/f97305f6a64e238aaf5934dc8f913995/.npmrc
    [7:30:11 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/npm"
    [7:30:11 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/github"
    [7:30:11 PM] [semantic-release] [@semantic-release/github] › ℹ  Verify GitHub authentication
    [7:30:11 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/github"
    [7:30:11 PM] [semantic-release] › ℹ  Found git tag v2.2.1 associated with version 2.2.1 on branch semantic-release
    [7:30:11 PM] [semantic-release] › ℹ  Found 1 commits since last release
    [7:30:11 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
    [7:30:11 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: fix: semantic-release local test
    [7:30:11 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The release type for the commit is patch
    [7:30:11 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analysis of 1 commits complete: patch release
    [7:30:11 PM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
    [7:30:11 PM] [semantic-release] › ℹ  The next release version is 2.2.2
    [7:30:11 PM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
    [7:30:11 PM] [semantic-release] › ✔  Completed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
    [7:30:11 PM] [semantic-release] › ℹ  Start step "prepare" of plugin "@semantic-release/npm"
    [7:30:11 PM] [semantic-release] [@semantic-release/npm] › ℹ  Write version 2.2.2 to package.json in /Users/abernier/Sites/camera-controls
    v2.2.2
    [7:30:12 PM] [semantic-release] › ✔  Completed step "prepare" of plugin "@semantic-release/npm"
    [7:30:15 PM] [semantic-release] › ✔  Created tag v2.2.2
    [7:30:15 PM] [semantic-release] › ℹ  Start step "publish" of plugin "@semantic-release/npm"
    [7:30:15 PM] [semantic-release] [@semantic-release/npm] › ℹ  Publishing version 2.2.2 to npm registry on dist-tag latest
    
    > [email protected] prepack
    > npm run build
    
    
    > [email protected] build
    > rollup --config && terser dist/camera-controls.js -o dist/camera-controls.min.js --comments '/^!/' && downlevel-dts . .
    
    (node:47681) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
    (Use `node --trace-warnings ...` to show where the warning was created)
    
    src/index.ts → dist/camera-controls.js, dist/camera-controls.module.js...
    created dist/camera-controls.js, dist/camera-controls.module.js in 758ms
    npm notice 
    npm notice 📦  [email protected]
    npm notice === Tarball Contents === 
    npm notice 1.1kB   LICENSE                                         
    npm notice 104.2kB dist/camera-controls.js                         
    npm notice 55.6kB  dist/camera-controls.min.js                     
    npm notice 101.6kB dist/camera-controls.module.js                  
    npm notice 29.1kB  dist/CameraControls.d.ts                        
    npm notice 75B     dist/constants.d.ts                             
    npm notice 1.2kB   dist/EventDispatcher.d.ts                       
    npm notice 84B     dist/index.d.ts                                 
    npm notice 3.3kB   dist/types.d.ts                                 
    npm notice 183B    dist/utils/extractClientCoordFromEvent.d.ts     
    npm notice 968B    dist/utils/math-utils.d.ts                      
    npm notice 209B    dist/utils/notSupportedInOrthographicCamera.d.ts
    npm notice 2.2kB   package.json                                    
    npm notice 36.0kB  readme.md                                       
    npm notice === Tarball Details === 
    npm notice name:          camera-controls                         
    npm notice version:       2.2.2                                   
    npm notice filename:      camera-controls-2.2.2.tgz               
    npm notice package size:  63.4 kB                                 
    npm notice unpacked size: 335.8 kB                                
    npm notice shasum:        293a10c068aaea422e618ecf67fb07de6e183d55
    npm notice integrity:     sha512-bploCJJbProhf[...]/tHwcYUEcZXbA==
    npm notice total files:   14                                      
    npm notice 
    npm notice Publishing to http://localhost:4873/
    + [email protected]
    [7:30:18 PM] [semantic-release] [@semantic-release/npm] › ℹ  Published [email protected] to dist-tag @latest on http://localhost:4873/
    [7:30:18 PM] [semantic-release] › ✔  Completed step "publish" of plugin "@semantic-release/npm"
    [7:30:18 PM] [semantic-release] › ℹ  Start step "publish" of plugin "@semantic-release/github"
    [7:30:19 PM] [semantic-release] [@semantic-release/github] › ℹ  Published GitHub release: https://github.com/abernier/camera-controls/releases/tag/v2.2.2
    [7:30:19 PM] [semantic-release] › ✔  Completed step "publish" of plugin "@semantic-release/github"
    [7:30:19 PM] [semantic-release] › ℹ  Start step "success" of plugin "@semantic-release/github"
    [7:30:23 PM] [semantic-release] [@semantic-release/github] › ℹ  Closed issue #1: https://github.com/abernier/camera-controls/issues/1.
    [7:30:23 PM] [semantic-release] › ✔  Completed step "success" of plugin "@semantic-release/github"
    [7:30:23 PM] [semantic-release] › ✔  Published release 2.2.2 on default channel

Resulting built+published on my local registry Verdaccio:
image

Resulting release on my fork: https://github.com/abernier/camera-controls/releases/tag/v2.2.2
image

@abernier abernier force-pushed the semantic-release branch 2 times, most recently from c1686b2 to 9cde8c3 Compare February 10, 2023 16:29
@abernier abernier force-pushed the semantic-release branch 2 times, most recently from 4d5c757 to c107c50 Compare February 10, 2023 17:05
@abernier abernier force-pushed the semantic-release branch 2 times, most recently from 1adf944 to 9a3ef15 Compare February 10, 2023 17:36
@abernier abernier marked this pull request as draft February 10, 2023 17:37
@abernier abernier force-pushed the semantic-release branch 2 times, most recently from 90c471e to e20e525 Compare February 10, 2023 18:41
@abernier abernier marked this pull request as ready for review February 10, 2023 18:44
@abernier abernier force-pushed the semantic-release branch 10 times, most recently from 9e8b634 to d542fca Compare February 11, 2023 17:19
@yomotsu
Copy link
Owner

yomotsu commented Feb 16, 2023

Thanks for your research and change.
It works without the error.✨🌟


image

@abernier abernier force-pushed the semantic-release branch 3 times, most recently from 7efbf01 to d84f189 Compare February 16, 2023 17:15
@abernier
Copy link
Collaborator Author

abernier commented Feb 16, 2023

Thanks for your research and change.
It works without the error.✨🌟

Thanks, even if you haven't reproduced entirely the doc generation1, I'm pretty confident.

I've now set/reset all the temporary values: we should be good to merge.


Some last points to ultimately check on your part before the merge:

The merge of this PR should trigger a v2.2.2 release because of the commit message I've explicitly set to fix:(to force a release so we can verify it is working2).

I let you do the final review ;)

Footnotes

  1. I think you previously got the message "The local branch semantic-release is behind the remote one, therefore a new version won't be published." because I had defined "repository": "abernier/camera-controls" in package.json for my own tests. So it was comparing the local CI semantic-release branch with my abernier:semantic-release remote branch: "Run automated release from branch semantic-release on repository abernier/camera-controls"!

  2. even if semantically speaking, it would rather have been chore: (but this wouldn't have triggered a release then)

@abernier abernier marked this pull request as ready for review February 16, 2023 17:18
@abernier abernier force-pushed the semantic-release branch 4 times, most recently from bc49965 to 9512e62 Compare February 16, 2023 23:47
@yomotsu yomotsu merged commit 5546a53 into yomotsu:dev Feb 19, 2023
@github-actions
Copy link

🎉 This PR is included in version 2.2.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@yomotsu
Copy link
Owner

yomotsu commented Feb 19, 2023

@abernier

Thank you so so so much for your all advice and efforts.
This has been merged and works well.
and I have one last question (Continued below

the action: without errors
image

in NPM: published successfully
image

Could we watch the master/main branch instead of the dev for this action?
I'm concerned that this action will run for every PR merge.

For instance, now I have 2 PRs. If I merge both to the dev, does it cause 2 version updates?
image

I usually merge every PRs to dev, then merge dev to master, then publish master to NPM with all merged PRs.
(Sorry, this repo was created long ago, since master is the default, and still uses it...eventually)

@abernier
Copy link
Collaborator Author

abernier commented Feb 19, 2023

I'm relieved it went smoothly :)

For instance, now I have 2 PRs. If I merge both to the dev, does it cause 2 version updates?

No because I've set up this to prevent that:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

If you merge both PRs "fast enough"(which I agree is tricky), the last release-workflow wins and cancels the previous one(s).

It may be not ideal, and yes we could totally and easily change the release-branch from dev to master if you want, but I guess there may be a better option with a merge queue: https://github.blog/changelog/2023-02-08-pull-request-merge-queue-public-beta/
image

It basically has a timeout that triggers the merge if no PR has been merged since this timeout. It seems designed for the need of grouping PRs together.

It's all new and I have never tried it yet, but may worth a try? What do you think?

@abernier
Copy link
Collaborator Author

abernier commented Feb 19, 2023

Oh but I'm realising that:

merge queues are available in any public repository owned by an organization

-- from "Managing a merge queue" Github doc

so it won't be available for yomotsu/camera-controls unfortunately...

@abernier
Copy link
Collaborator Author

abernier commented Feb 19, 2023

So if you prefer, we can prepare a new PR to set the release-branch on master (rather than dev).

It will allow you to merge on dev without systematically releasing a new version immediately.

@abernier
Copy link
Collaborator Author

abernier commented Feb 19, 2023

Just for info,

If we look how it works for pmndrs/drei releases, it is actually defined the same as for yomotsu/camera-controls: they use their default-branch1 as their release-branch.

Therefore, if you look at the releases list, nearly each release is composed of a single PR merge: https://github.com/pmndrs/drei/releases
=> This is also why there are so many releases! (but is less would be preferable?)

One exception is this v9.56.25 release: composed of 2 PRs #1291 and #1294 => we can see in the Actions, that the first run was cancelled (by the second one): https://github.com/pmndrs/drei/actions/runs/4195191937


I guess it's really a matter of preference here. It would have been cool to test the new "merge-queue" feature, but since it is not available for personal repos, I guess you have to decide on this: release-branch set on dev or master :)

Footnotes

  1. their default-branch is master for us, CC's one default-branch is dev

@abernier abernier mentioned this pull request Feb 19, 2023
1 task
@abernier
Copy link
Collaborator Author

I have drafted a PR #377 if you want to switch to master as the release-branch ;)

@abernier abernier deleted the semantic-release branch February 19, 2023 17:50
@abernier abernier restored the semantic-release branch February 19, 2023 17:50
@abernier abernier deleted the semantic-release branch February 19, 2023 17:50
@abernier abernier restored the semantic-release branch February 19, 2023 17:51
@yomotsu
Copy link
Owner

yomotsu commented Feb 20, 2023

Sorry for the delay, and thank you for taking the time to think about this.

If you merge both PRs "fast enough"

Okay, let me try with the 2 PRs.

=> This is also why there are so many releases!

good to know that...! that's why.

@yomotsu
Copy link
Owner

yomotsu commented Feb 20, 2023

As you mentioned, it works for multiple merges. (and no need to write a change log...! 🤩)

image

But now I worry about what if I got a conflict meantime.
I really appreciate your all devices. but let me use master for a little while longer with your another PR #377 🥺

@abernier abernier mentioned this pull request Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants