Open itsTalwar opened 4 months ago
61f1a06356
)[!TIP] I can email you next time I complete a pull request if you set up your email here!
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
.github/workflows/semantic-release.yml
✓ https://github.com/itsTalwar/meerkat/commit/45ef6aeadadfbcad7f0dffdb8ef86a1abc93ab4b Edit
Create .github/workflows/semantic-release.yml with contents:
• Create a new GitHub Actions workflow file named "semantic-release.yml" in the ".github/workflows" directory. This workflow will trigger the semantic release process for each NX package.
• The workflow should be configured to run on pushes to the main branch and for any pull request events.
• Use the "actions/checkout" action to check out the code.
• Set up Node.js environment using "actions/setup-node" action with a specified Node.js version that matches the development environment.
• Install dependencies using "npm install".
• For each NX package ("meerkat-core", "meerkat-node", "meerkat-browser"), add a job that runs the "npm run release" script defined in their "package.json" files. Ensure to navigate to the correct directory for each package before running the script.
• Use matrix strategy if possible to avoid redundancy and make the workflow more maintainable.
.github/workflows/semantic-release.yml
✓ Edit
Check .github/workflows/semantic-release.yml with contents:
Ran GitHub Actions for 45ef6aeadadfbcad7f0dffdb8ef86a1abc93ab4b:
tools/scripts/publish.mjs
✓ https://github.com/itsTalwar/meerkat/commit/a2d637e4d0b1369d3a783c571e6968c3e3cdc4e3 Edit
Modify tools/scripts/publish.mjs with contents:
• Modify the "publish.mjs" script to integrate with the semantic release process. Specifically, update the script to accept a new argument for the release type (e.g., major, minor, patch) and adjust the versioning logic accordingly.
• Ensure that the script reads the version number from the "package.json" file of the package being published, which should have been updated by the semantic release process before this script is called.
• Add error handling to gracefully manage any issues that arise during the publishing process, including logging errors and exiting with a non-zero status code if necessary.
• Update the documentation/comments within the script to reflect these changes and provide guidance on how it should be used as part of the semantic release process.
--- +++ @@ -22,7 +22,17 @@ // Executing publish script: node path/to/publish.mjs {name} --version {version} --tag {tag} // Default "tag" to "next" so we won't publish the "latest" tag by accident. -const [, , name, version, tag = 'next'] = process.argv; +const [, , name, tag = 'next', releaseType] = process.argv; + +// Read version from package.json +let version; +try { + const packageJson = JSON.parse(readFileSync('package.json').toString()); + version = packageJson.version; +} catch (error) { + console.error('Failed to read version from package.json:', error); + process.exit(1); +} // A simple SemVer validation to validate the version const validVersion = /^\d+\.\d+\.\d+(-\w+\.\d+)?/;
tools/scripts/publish.mjs
✓ Edit
Check tools/scripts/publish.mjs with contents:
Ran GitHub Actions for a2d637e4d0b1369d3a783c571e6968c3e3cdc4e3:
I have finished reviewing the code for completeness. I did not find errors for sweep/add_semantic_github_release_for_nx_packa
.
💡 To recreate the pull request edit the issue title or description. Something wrong? Let us know.
This is an automated message generated by Sweep AI.
Currently we are doing manual versioning, can we follow do semantic github release ?
Checklist
- [X] Create `.github/workflows/semantic-release.yml` ✓ https://github.com/itsTalwar/meerkat/commit/45ef6aeadadfbcad7f0dffdb8ef86a1abc93ab4b [Edit](https://github.com/itsTalwar/meerkat/edit/sweep/add_semantic_github_release_for_nx_packa/.github/workflows/semantic-release.yml) - [X] Running GitHub Actions for `.github/workflows/semantic-release.yml` ✓ [Edit](https://github.com/itsTalwar/meerkat/edit/sweep/add_semantic_github_release_for_nx_packa/.github/workflows/semantic-release.yml) - [X] Modify `tools/scripts/publish.mjs` ✓ https://github.com/itsTalwar/meerkat/commit/a2d637e4d0b1369d3a783c571e6968c3e3cdc4e3 [Edit](https://github.com/itsTalwar/meerkat/edit/sweep/add_semantic_github_release_for_nx_packa/tools/scripts/publish.mjs) - [X] Running GitHub Actions for `tools/scripts/publish.mjs` ✓ [Edit](https://github.com/itsTalwar/meerkat/edit/sweep/add_semantic_github_release_for_nx_packa/tools/scripts/publish.mjs)