Skip to content

Conversation

@microbit-robert
Copy link
Contributor

No description provided.

Comment on lines 31 to 33
- uses: microbit-foundation/npm-package-versioner-action@v1
with:
working-directory: ./header-gen
Copy link
Collaborator

Choose a reason for hiding this comment

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

Assuming the workflow will be to keep updating the extension to pxt bump, and to manually create a GH release from an existing tag when need to push this package, then that means the package will follow the same version as the pxt extension.

I think this is perfectly fine, just wanted to double check this is the intention and the proposed workflow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this makes sense.

@microbit-robert
Copy link
Contributor Author

@microbit-carlos I've attempted the merge with header-gen.yml.

working-directory: ./header-gen

- name: Update version
if: github.event_name != 'pull_request'
Copy link
Collaborator

Choose a reason for hiding this comment

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

This step will also run on any pushes with changes to the header-gen source code, even if they are not meant to update the package version yet (which likely has already increased as we pxt bump the extension), is that the intention?

I assume this action only creates a commit if the version in package.json and the version in the last repo tag don't match?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case, the action should create a published version with something like @0.1.0-[branch_name].[build_number]. It should never create any commits.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But looking at the description in https://github.com/microbit-foundation/npm-package-versioner-action it sounds like if the package.json version entry needs to be updated it will do that? Does it do it without committing the change to the repo?

So, it changes package.json, builds package, pushes it to the package registry with a temporary tag like @0.1.0-[branch_name].[build_number] and doesn't commit anything? At what point it will push a package with the correct version number?

Copy link
Collaborator

Choose a reason for hiding this comment

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

sorry, the publishing is done by the npm publish step.

So, the microbit-foundation/npm-package-versioner-action action will change the package.json version entry if needed (maybe to 0.1.0-[branch_name].[build_number] as you mentioned), without committing anything and then it's up to other steps to create and/or publish the package. Is that right?

How does it decide if the version entry in package.json needs to be changed? is it if this commit is tagged AND the tag version is the same as the version in package.json?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apologies. This is ignorance on my part. We've not used this in prod yet and I naively assumed it would work in the same way as the package it's trying to replace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. It looks like it just changes the version in package.json without commiting anything. The udpated version number is only used for npm publish in that workflow.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Great, thanks Rob!

@microbit-carlos
Copy link
Collaborator

@microbit-robert just a friendly ping that there are still a couple of open comments on this PR before we can merge it, which we might want to do to publish this package for (microbit-foundation/pxt-microbit-ml#5)

Co-authored-by: Carlos Pereira Atencio <carlos@microbit.org>
Copy link
Collaborator

@microbit-carlos microbit-carlos left a comment

Choose a reason for hiding this comment

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

Looks good, thanks Rob!

@microbit-carlos microbit-carlos merged commit 521c940 into main Jun 11, 2024
@microbit-carlos microbit-carlos deleted the gh-actions branch June 11, 2024 09:55
@microbit-carlos
Copy link
Collaborator

@microbit-robert Publishing failed in:
https://github.com/microbit-foundation/pxt-ml-runner-poc/actions/runs/9479430290/job/26117936317

npm error code ENEEDAUTH
npm error need auth This command requires you to be logged in to https://registry.npmjs.org/
npm error need auth You need to authorize this machine using `npm adduser`

Does the access right for this repo has to be managed from the org settings?

@microbit-robert
Copy link
Contributor Author

microbit-robert commented Jun 12, 2024

@microbit-robert Publishing failed in: https://github.com/microbit-foundation/pxt-ml-runner-poc/actions/runs/9479430290/job/26117936317

npm error code ENEEDAUTH
npm error need auth This command requires you to be logged in to https://registry.npmjs.org/
npm error need auth You need to authorize this machine using `npm adduser`

Does the access right for this repo has to be managed from the org settings?

It's trying to publish in the wrong place. I'm guessing it's not reading the .npmrc file in working-directory. We can try moving it to the root of the project and also changing the name in the package.json from "ml-header-generator" to "@microbit-foundation/ml-header-generator".

@microbit-carlos
Copy link
Collaborator

In the end it only needed the @microbit-foundation in the package name:
https://github.com/microbit-foundation/pxt-ml-runner-poc/pkgs/npm/ml-header-generator

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.

4 participants