-
-
Notifications
You must be signed in to change notification settings - Fork 11
feat: add preview command to covector #187
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
Conversation
9e71839
to
9afbd3e
Compare
2e9d04a
to
b6366fc
Compare
e6a75ef
to
b851087
Compare
c92e409
to
b69ebc2
Compare
How does this relate to when you have a preview, but no PR? In other words, the mainline is |
Jacob is working on that part. |
Yep, prereleases coming in #180. |
Seems like an oversight. We can probably open an issue and fix it in a separate PR.
I believe the caveat here is that it will only bump the dependencies if the main package version also has a bump. Do you think that was the case? It is kind of hard to tell from that output.
The
I am going to need this for prereleases as well. I think we can address this in a follow up PR. |
I believe it would look like: {
"name": "package-A",
"version": "1.0.0-abcdef"
},
{
"name": "package-B",
"version": "1.0.0-abcdef",
"dependencies:": {
"package-A": "1.0.0-abcdef"
}
} The bump to
The
So locally it gets hard-coded, but in CI, it relies on an env var so you can pass it in through your secrets. |
So if I have a change file for
So the setup-node action sets the config file and so for the rest of the workflow it would have access to config but why does the token need to be passed into covector's action? - uses: actions/setup-node@v2
with:
registry-url: "https://registry.npmjs.org"
- name: git config
run: |
git config --global user.name "${{ github.event.pusher.name }}"
git config --global user.email "${{ github.event.pusher.email }}"
- run: npm ci --ignore-scripts
- run: npm run build
- run: npm run pkg -w action
- name: covector version-or-publish
uses: ./packages/action
id: covector
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: "version-or-publish"
createRelease: true |
Hmm, to get the whole and properly bumping, we chain a few functions together. The only things I can guess are bug or we are missing one of those links in the chain?
It sets up the |
d48e48f
to
d559317
Compare
d559317
to
670048b
Compare
@@ -300,12 +309,12 @@ const bumpMain = ({ | |||
if (pkg.vfile.extname === ".json") { | |||
// for javascript | |||
// @ts-ignore TODO bumpType should be narrowed to meet ReleaseType | |||
let version = semver.inc(pkg.pkg.version, bumpType); | |||
let version = previewVersion ? semver.valid(`${pkg.pkg.version}-${previewVersion}`) : semver.inc(pkg.pkg.version, bumpType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a couple tests in apply
to confirm that version number that is output (and see we don't break it in the future)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"}\n" | ||
); | ||
|
||
expect({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the snapshot, consoleDir
and consoleLog
don't have any data, Is that expected? I presume there would be some output here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why there's no console log is because it's been omitted but I just added it here
}, | ||
"version": "0.6.2-branch-name.12345", | ||
}, | ||
"version": "0.6.2-branch-name.12345", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we are getting the version here 👍 . It doesn't seem like it is attempting to publish it though, I imagine because of the change files? May be worth creating a new fixture if it is painful finding one that works for your tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem like it is attempting to publish it though
Doesn't this mean it did try to publish?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was looking for something like "Checking if [email protected] is already published with: echo 0.5.2",
, but not seeing it which is kind of confusing. Like I don't see any of the output mention trying to publish tauri.js
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But yea, you are right, it does say "tauri.js [publish]: echo publishing tauri.js would happen here",
. I wonder if it is worth checking the version there by adjusting that publish command to echo it out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in that fixture, there's a change file for tauri and tauri-updater. tauri-updater isn't in the snapshot because publish is set to false. tauri.js gets a preview bump because it lists tauri as a dependency. But that doesn't explain why tauri isn't getting bumped and why tauri.js isn't trying to publish. This might have to do with the bug I pointed out about the interdependent bumping logic.
Array [ | ||
"bumping package-b to 0.0.1-branch-name.12345 to publish a preview", | ||
], | ||
Array [ | ||
"bumping package-a to 0.0.1-branch-name.12345 to publish a preview", | ||
], | ||
Array [ | ||
"package-a [publish]: echo publishing package-a would happen here", | ||
], | ||
Array [ | ||
"publishing package-a would happen here", | ||
], | ||
Array [ | ||
"package-b [publish]: echo publishing package-b would happen here", | ||
], | ||
Array [ | ||
"publishing package-b would happen here", | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this new fixture I have package-a
and package-b
and package-a
has package-b
as one of its dependencies. I added a changefile only for package-b
to see if it'll bump the dependency inside package-a
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So maybe the issue we saw earlier comes from when different managers are mixed in together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So maybe the issue we saw earlier comes from when different managers are mixed in together?
That would be surprising to me. It might be worth adding a package-c
with the same manager as your change to confirm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should package-c have any dependencies? or have it be added as a dependency to package-a or package-b?
"pkg": Object { | ||
"dependencies": Object { | ||
"package-b": "0.0.1-branch-name.12345", | ||
}, | ||
"name": "package-a", | ||
"version": "0.0.1-branch-name.12345", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package-a
* Fix overlooked refactor of a variable in apply * Rename package files in config to match the packages json files * Reintroduce accidentally deleted toml file in fixtures * Fix change files with the correct package names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
Motivation
To continue the work of #179 and implement the actual preview command within covector. (179 set up the preview workflow and the basic conditionals within the action and covector to allow preview commands).
Approach
preview
as default. You can specify your own like this:date
andsha
. If none is provided, the default will bedate
:date
=1.0.0-${Date.now()}
=1.0.0-1618444347550
sha
=1.0.0-${commit.substring(0, 7)}
=1.0.0-abcdefg
apply
has a new argument that determines if a dependency bump should use its normalsemver.inc(bumpType)
orsemver.valid(previewVersionTemplate)
bumpDep
is never triggered? See TODOs below.preview
command insidecovector
pretty much runsversion
and thenpublish
but without deleting the change files or modifying the changelogs.postPublish
commandpreview
label to the version PR creating step insiderun-version-or-publish
workflow to automatically opt-in to publishing preview packages. This takes care of "case 3"TODOs
Will do this in a separate PR.feat: pr comment generator for covector preview #191I set the timeout to x2 the regular length because we're doing twice the work inNo.preview
. Should I keep it that way or just set it back to normal?Separate PRpackagesPublished
set here seems to always return an empty string on account ofcovectored[pkg].published
boolean never being set.I wanted to seeFixed in bug: Fix bumping error #198:bumpDep
in action so I ran the preview action with only change files for@covector/files
hoping it'll update the@covector/files
dependencies forapply
,covector
,assemble
, andchangelog
but it only bumpedcovector
,files
, andaction
Screenshot
How doesenv.NODE_AUTH_TOKEN
get used? I can't find it in the action. I haven't been publishing any packages with covector yet but I'm guessing when it actually tries to publish it won't be authenticated yet.I haven't done npm tags yet. Should I include that in this PR? Doesn't need to be in the same PR because pre-release semver won't be tagged as latest (1.0.0 will still be latest if you publish 1.0.1-12345)Separate PR