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

Add publish workflow #203

Conversation

aefhm
Copy link
Contributor

@aefhm aefhm commented Oct 12, 2023

Description

Automatically publish newer versions of different JS packages to NPM if they are not present on the registry already on all pushes to the main branch.

TODO

  • Potentially update documentation to reflect the need for a post-merge tag step

@aefhm aefhm self-assigned this Oct 12, 2023
@kostko

This comment was marked as duplicate.

1 similar comment
@kostko
Copy link
Member

kostko commented Oct 12, 2023

@aefhm aefhm force-pushed the CU-863h6mt6x_Use-CI-to-publish-NPM-packages-on-sapphire-paratime-repo_Xi-Zhang branch 2 times, most recently from d66d65c to 4078153 Compare October 12, 2023 23:59
@aefhm aefhm added p:1 Priority: high s:underway Status: a patch is in progress github_actions Pull requests that update GitHub Actions code js blocked Pull requests that are blocked by another issue labels Oct 13, 2023
@aefhm aefhm force-pushed the CU-863h6mt6x_Use-CI-to-publish-NPM-packages-on-sapphire-paratime-repo_Xi-Zhang branch 9 times, most recently from b6f4ec1 to 0f766f3 Compare October 13, 2023 16:50
@aefhm aefhm changed the title [wip] Add publish workflow Add publish workflow Oct 13, 2023
.github/workflows/publish.yaml Outdated Show resolved Hide resolved
@aefhm aefhm force-pushed the CU-863h6mt6x_Use-CI-to-publish-NPM-packages-on-sapphire-paratime-repo_Xi-Zhang branch from 0f766f3 to 186be4d Compare October 13, 2023 17:13
@aefhm aefhm requested review from matevz and CedarMist October 13, 2023 17:14
@aefhm aefhm marked this pull request as ready for review October 13, 2023 17:14
@aefhm
Copy link
Contributor Author

aefhm commented Oct 13, 2023

@CedarMist @matevz One alternative is something with more full-fledged change logs such as changesets which pnpm recommends. We don't have such a large monorepo with just 3 packages and mostly a linear development cycle, so I think something lightweight such as this GitHub action is sufficient.

@aefhm aefhm removed the blocked Pull requests that are blocked by another issue label Oct 14, 2023
@CedarMist
Copy link
Member

The simple github action looks easiest.

@CedarMist
Copy link
Member

@aefhm

I don't think doing releases on every main merge will work.

Instead, we need to tag specific releases, and only upon tagging will that specific package get published.

@kostko
Copy link
Member

kostko commented Oct 14, 2023

Yeah it should be based on tags, just note that in this repo we are also using tags to automatically release the runtime, so make sure to namespace the tags.

@aefhm
Copy link
Contributor Author

aefhm commented Oct 16, 2023

@aefhm

I don't think doing releases on every main merge will work.

Instead, we need to tag specific releases, and only upon tagging will that specific package get published.

Just clarifying that this specific GitHub action (which would run on every main push) checks to see if the present package version has been published to NPM, and only publishes if not present.

Can definitely switch workflow trigger to a regex based on some name-spaced tag like (Core does go/v0.2202.10), so perhaps clients/js/{{version}} and so on.

@aefhm
Copy link
Contributor Author

aefhm commented Oct 16, 2023

Yeah it should be based on tags, just note that in this repo we are also using tags to automatically release the runtime, so make sure to namespace the tags.

Confirming that by this we mean Git tags? I think/agree we should reserve the use of the release release for the paratime itself. Clients can just live with a trigger from simple Git tag on push.

@CedarMist
Copy link
Member

Yup so package specific tags such as:

  • contracts/0.2.4
  • clients/js/1.1.1

With the Github release reserved for Sapphire releases (e.g. 0.6.4)

@aefhm aefhm force-pushed the CU-863h6mt6x_Use-CI-to-publish-NPM-packages-on-sapphire-paratime-repo_Xi-Zhang branch 10 times, most recently from 59fb520 to 4af0445 Compare October 16, 2023 23:27
@aefhm aefhm force-pushed the CU-863h6mt6x_Use-CI-to-publish-NPM-packages-on-sapphire-paratime-repo_Xi-Zhang branch from 4af0445 to 633d62d Compare October 16, 2023 23:35
Copy link
Member

@CedarMist CedarMist left a comment

Choose a reason for hiding this comment

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

Always a bit nervous about testing NPM deploys, does that mean the final test is essentially in production?

@aefhm
Copy link
Contributor Author

aefhm commented Oct 17, 2023

Always a bit nervous about testing NPM deploys, does that mean the final test is essentially in production?

More or less 😬. I couldn't test the tag piece (due to GitHub permissions), but we could always take down an NPM package if need be.

The one nice thing about this particular GitHub action versus writing more bare bones script is the release check, and we could always tag a patch first.

Copy link
Member

@matevz matevz left a comment

Choose a reason for hiding this comment

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

Small nit regarding the leading v. Otherwise, I look forward to having this in oasis-sdk repo for the client-sdk/ts-web as well! ;)

.github/workflows/publish.yaml Outdated Show resolved Hide resolved
@aefhm aefhm force-pushed the CU-863h6mt6x_Use-CI-to-publish-NPM-packages-on-sapphire-paratime-repo_Xi-Zhang branch from 407e789 to 20e15f6 Compare October 17, 2023 15:48
@aefhm aefhm force-pushed the CU-863h6mt6x_Use-CI-to-publish-NPM-packages-on-sapphire-paratime-repo_Xi-Zhang branch from 20e15f6 to 935c121 Compare October 17, 2023 21:37
@aefhm aefhm enabled auto-merge October 17, 2023 21:40
@aefhm aefhm merged commit a0cf719 into main Oct 17, 2023
16 checks passed
@aefhm aefhm deleted the CU-863h6mt6x_Use-CI-to-publish-NPM-packages-on-sapphire-paratime-repo_Xi-Zhang branch October 17, 2023 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github_actions Pull requests that update GitHub Actions code p:1 Priority: high s:underway Status: a patch is in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants