Skip to content
New issue

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

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

Already on GitHub? # to your account

automate workflow for npm publish #497

Merged
merged 9 commits into from
Feb 21, 2021
Merged

Conversation

amacado
Copy link
Member

@amacado amacado commented Feb 21, 2021

I created a workflow which will be triggered when a new release is created. The workflow will try to publish the latest version to npm.

When we want to create a new release, we need to update the package.json and package-lock.json and set it to the new release version. This can be done via the command (replace v2.9.0 with the new version):

npm version v2.9.0 -m "bump npm version to %s"

This should be done before development is merged into master and a new release is created. Otherwise the workflow will fail and throw this exception:

403 403 Forbidden - PUT https://registry.npmjs.org/devicon - You cannot publish over the previously published versions: xxx.

When this error occurs you need to checkout the branch, bump the version in the package.json and either publish the package manually or creating a new release to trigger the workflow again.

@amacado amacado added enhancement devops Use this label for devops related enhancements labels Feb 21, 2021
@amacado amacado requested a review from Thomas-Boi February 21, 2021 02:19
@amacado amacado linked an issue Feb 21, 2021 that may be closed by this pull request
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Member

@Thomas-Boi Thomas-Boi left a comment

Choose a reason for hiding this comment

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

Hey amacado,

The code looks good. I briefly wonder if we should make an action to automate this but we probably won't do releases that often to warrant that.

Good job on this feature. I totally forgot about it 😅

@amacado amacado merged commit bdf2627 into develop Feb 21, 2021
@amacado amacado deleted the amacado/feature/npm-publish branch February 21, 2021 22:02
@amacado amacado mentioned this pull request Feb 21, 2021
4 tasks
GCHQDeveloper926 pushed a commit to GCHQDeveloper926/devicon that referenced this pull request Dec 20, 2024
* setup npm_publish workflow and update package.json with new repo info

* refactoring npm publish workflow to reduce dependencies

* npm publish to 2.9.0

* reduce npm publish workflow to publishing task only

* npm publish to 2.9.0

* testing npm publish

* update npm version to 2.9.0 (latest release)

* enhance CONTRIBUTING.md with sentence about npm release workflow
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
devops Use this label for devops related enhancements enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

npm release
2 participants