Skip to content

ci: use standard-version to generate new version from conventional commits#33

Closed
SKalt wants to merge 1 commit intogbprod:mainfrom
SKalt:automate-npm-and-cargo-releases
Closed

ci: use standard-version to generate new version from conventional commits#33
SKalt wants to merge 1 commit intogbprod:mainfrom
SKalt:automate-npm-and-cargo-releases

Conversation

@SKalt
Copy link
Copy Markdown
Contributor

@SKalt SKalt commented Apr 11, 2023

This PR adds a local workflow for creating a git tag for a release. Here's the proposed workflow: npm run prepare-release will run standard-version. standard-version bumps the versions in package.json and Cargo.toml and adds an autogenerated entry to CHANGELOG.md, then commits those changes and tags them with the new version. You can safely test this workflow locally.

This tooling augments the new github workflows for #30 : you can associate a new release with the generated tags, or you could trigger the package-publishing workflows

on:
  push:
    tags:
      - 'v*.*.*'

Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/release.yml Outdated
Comment thread .github/workflows/release.yml Outdated
Comment thread Cargo.lock
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This diff arose due to running cargo update, which I ran while experimenting with publishing a crate. While not strictly related to this PR, it's worth keeping.

Comment thread Cargo.toml
name = "tree-sitter-gitcommit"
description = "gitcommit grammar for the tree-sitter parsing library"
version = "0.0.1"
version = "0.2.0"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I had to manually bump this version to match the version in package.json. scripts/update-cargo-version.js will handle version bumps.

@@ -0,0 +1,31 @@
/// @ts-check

const versionPattern = /[ \t]*version\s*=\s*"([^"]+)"/;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Using a regex is faster and easier to understand than parsing and patching the entire abstract syntax tree of the Cargo.toml document.

@SKalt SKalt changed the title ci: draft package release process ci: use standard-version to generate new version from conventional commits Apr 12, 2023
@SKalt SKalt force-pushed the automate-npm-and-cargo-releases branch 2 times, most recently from d3e6b14 to a173d77 Compare April 12, 2023 13:39
This commit adds a local workflow for creating a git tag
for a release.  Here's the proposed workflow: `npm run
prepare-release` will run `standard-version`. `standard-version`
bumps the versions in `package.json` and `Cargo.toml` and
adds an autogenerated entry to `CHANGELOG.md`, then
commits those changes and tags them with the new version.
You can safely test this workflow locally.

This tooling augments the new github workflows for gbprod#30:
 you can associate a new release with the generated tags,
or you could trigger the package-publishing workflows

```yaml
on:
  push:
    tags:
      - 'v*.*.*'
```
@SKalt SKalt force-pushed the automate-npm-and-cargo-releases branch from a173d77 to 5ff5a6e Compare April 12, 2023 13:46
@gbprod
Copy link
Copy Markdown
Owner

gbprod commented Apr 13, 2023

Thanks for your PR!
I will take some times to review and think about it.
I try to do it ASAP !

@gbprod gbprod force-pushed the main branch 4 times, most recently from 9093562 to adf879c Compare April 18, 2023 07:42
@gbprod
Copy link
Copy Markdown
Owner

gbprod commented Apr 19, 2023

Hi @SKalt !
I've made my own workflow to publish to crates and npm that better suits my way of working.
You can find the published version here :

@gbprod gbprod closed this Apr 19, 2023
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.

2 participants