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

feat: add beta release workflow #1148

Merged
merged 6 commits into from
May 8, 2024
Merged

Conversation

danielbarion
Copy link
Member

@danielbarion danielbarion commented Jan 2, 2024

With the beta release workflow, all commits into the PR will trigger the beta release.

  • the beta release always release a new beta version, following this format:
    react-tooltip@{__VERSION__}-beta.{__PR_NUMBER__}.rc.{__BETA_VERSION__} -> react-tooltip@v0.0.11-beta.1.rc.1
  • to skip the workflow we need to add the following words to the commit message:
[skip ci]
[ci skip]
[no ci]
[skip actions]
[actions skip]

https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs

image image

https://www.npmjs.com/package/auto-beta-release?activeTab=versions

Summary by CodeRabbit

  • New Features
    • Introduced automated workflows for beta releases, enhancing the release process.
    • Updated Bundlesize GitHub Action to improve the reliability of bundle size checks.
    • Expanded node version support in linting workflow to include the latest version.
  • Enhancements
    • Streamlined naming for linting workflow for better clarity.
  • Documentation
    • Adjusted workflow documentation to reflect updated action versions and configurations.
  • Dependencies
    • Added a new dependency (minimist) to improve command line parsing capabilities.

Copy link

github-actions bot commented Jan 2, 2024

Beta version released with the last commit 🚀

yarn add react-tooltip@v5.25.2-beta.1148.0

or

npm install react-tooltip@v5.25.2-beta.1148.0

Copy link

github-actions bot commented Jan 2, 2024

Beta version released with the last commit 🚀

yarn add react-tooltip@v5.25.2-beta.1148.2

or

npm install react-tooltip@v5.25.2-beta.1148.2

@gabrieljablonski
Copy link
Member

The gh-actions commit (9319c87 for instance) seems to be "hiding" the last checks that were run.

image

Expected to see the checks, like this.

image

Copy link
Member

@gabrieljablonski gabrieljablonski left a comment

Choose a reason for hiding this comment

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

Approving to see if checks are re-run. If not, changes should be made,

Copy link
Member

@gabrieljablonski gabrieljablonski left a comment

Choose a reason for hiding this comment

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

Nope 🤔

@danielbarion
Copy link
Member Author

that's weird, I didn't realize it before, thanks for letting me know, do you have any idea on how to fix it?

Copy link

github-actions bot commented Jan 2, 2024

Beta version released with the last commit 🚀

yarn add react-tooltip@v5.25.2-beta.1148.3

or

npm install react-tooltip@v5.25.2-beta.1148.3

Copy link

github-actions bot commented Jan 2, 2024

Beta version released with the last commit 🚀

yarn add react-tooltip@v5.25.2-beta.1148.4

or

npm install react-tooltip@v5.25.2-beta.1148.4

@danielbarion
Copy link
Member Author

@danielbarion
Copy link
Member Author

Beta version released with the last commit 🚀

yarn add react-tooltip@v5.25.2-beta.1148.5

or

npm install react-tooltip@v5.25.2-beta.1148.5

Copy link

github-actions bot commented Jan 2, 2024

Beta version released with the last commit 🚀

yarn add react-tooltip@v5.25.2-beta.1148.6

or

npm install react-tooltip@v5.25.2-beta.1148.6

Copy link

github-actions bot commented Apr 2, 2024

This pull request is stale because it has not seen activity in 30 days. Remove the stale label or comment within 14 days, or it will be closed.

@github-actions github-actions bot added the Stale This has not seen activity in quite some time label Apr 2, 2024
@danielbarion danielbarion removed the Stale This has not seen activity in quite some time label Apr 2, 2024
@danielbarion danielbarion force-pushed the feat/automated-beta-releases branch from 477f2d1 to b47e870 Compare May 7, 2024 19:43
Copy link

coderabbitai bot commented May 7, 2024

Walkthrough

The recent updates focus on enhancing GitHub workflows and scripts for better automation and maintenance of a software project. Key changes include the introduction of a new workflow for beta releases, updates to node versions and actions in existing workflows, and adjustments in scripts for beta version management. These modifications streamline development processes and improve the deployment pipeline.

Changes

Files Summary
.github/workflows/beta-release.yaml, beta-release.js Introduced and configured beta release automation.
.github/workflows/.../bundlesize.yaml, .github/workflows/.../lint.yaml Updated action versions, renamed workflows, and expanded node versions.
.github/workflows/.../pull-request.yaml Added a job for beta releases.
.github/workflows/.../stale.yml Adjusted indentation in workflow file.
package.json Added minimist dependency.

Poem

🐇💻

In the warren of code, under digital skies,
A rabbit hops forth, where the software lies.
With a flick and a click, new workflows align,
Beta releases dance, in a code-laced design.
Cheers to changes, both big and small,
In the heart of the code, the rabbit sees all. 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented May 7, 2024

Beta version released with the last commit 🚀

yarn add react-tooltip@5.26.4-beta.1148.rc.0

or

npm install react-tooltip@5.26.4-beta.1148.rc.0

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 54aeda9 and b47e870.
Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/*.lock
Files selected for processing (7)
  • .github/workflows/beta-release.yaml (1 hunks)
  • .github/workflows/bundlesize.yaml (3 hunks)
  • .github/workflows/lint.yaml (3 hunks)
  • .github/workflows/pull-request.yaml (1 hunks)
  • .github/workflows/stale.yml (1 hunks)
  • beta-release.js (1 hunks)
  • package.json (1 hunks)
Files skipped from review due to trivial changes (6)
  • .github/workflows/beta-release.yaml
  • .github/workflows/bundlesize.yaml
  • .github/workflows/lint.yaml
  • .github/workflows/pull-request.yaml
  • .github/workflows/stale.yml
  • package.json
Additional comments not posted (1)
beta-release.js (1)

12-18: The implementation of runCommand function looks good and properly handles command execution and output.

Comment on lines +20 to +75
const AutoBetaRelease = async () => {
// get all the versions of the package from npm
const { stdout } = await runCommand(`npm view . versions --json`)

// show npm published versions of this package
console.log(stdout)

// check if there is a beta release with the same issue number on published versions
const arrayOfBetaReleases = JSON.parse(stdout).filter((version) =>
version.includes(`${package.version}-beta.${issueNumber}`),
)

let fullLastBetaRelease = null

// if yes, get the latest beta release. Output: 1.0.0-beta.1.rc.0
if (arrayOfBetaReleases.length) {
fullLastBetaRelease = arrayOfBetaReleases[arrayOfBetaReleases.length - 1]
}

console.log('Last Beta Release: ', fullLastBetaRelease)

let nextBetaReleaseVersion = 0

if (fullLastBetaRelease) {
const lastBetaReleaseRCVersionArray = fullLastBetaRelease.match(/rc.+[0-9]+/g)

const lastBetaReleaseRCVersion =
lastBetaReleaseRCVersionArray && lastBetaReleaseRCVersionArray.length
? lastBetaReleaseRCVersionArray[0]
: null

const lastBetaReleaseVersion = lastBetaReleaseRCVersion
? lastBetaReleaseRCVersion.split('.')[1]
: 0

nextBetaReleaseVersion = parseInt(lastBetaReleaseVersion, 10) + 1
}

// next beta release version. Output: 1.0.0-beta.1.rc.1
const nextBetaReleaseVesionFull = `${package.version}-beta.${issueNumber}.rc.${nextBetaReleaseVersion}`

// update the beta version on package.json
const { error } = await runCommand(
`npm version ${nextBetaReleaseVesionFull} --no-git-tag-version`,
)

if (error) {
console.error(error)
return
}

// the beta version is already updated on package.json on the next line
console.log('Next Beta version: ', `${nextBetaReleaseVesionFull}`)

await runCommand(`echo "NEW_VERSION=${nextBetaReleaseVesionFull}" >> $GITHUB_ENV`)
}
Copy link

Choose a reason for hiding this comment

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

The AutoBetaRelease function is well-structured and handles the beta release process effectively. However, consider adding error handling for JSON parsing and command execution failures to enhance robustness.

+ try {
+   const arrayOfBetaReleases = JSON.parse(stdout).filter((version) =>
+     version.includes(`${package.version}-beta.${issueNumber}`),
+   );
+ } catch (error) {
+   console.error('Failed to parse JSON:', error);
+   return;
+ }

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
const AutoBetaRelease = async () => {
// get all the versions of the package from npm
const { stdout } = await runCommand(`npm view . versions --json`)
// show npm published versions of this package
console.log(stdout)
// check if there is a beta release with the same issue number on published versions
const arrayOfBetaReleases = JSON.parse(stdout).filter((version) =>
version.includes(`${package.version}-beta.${issueNumber}`),
)
let fullLastBetaRelease = null
// if yes, get the latest beta release. Output: 1.0.0-beta.1.rc.0
if (arrayOfBetaReleases.length) {
fullLastBetaRelease = arrayOfBetaReleases[arrayOfBetaReleases.length - 1]
}
console.log('Last Beta Release: ', fullLastBetaRelease)
let nextBetaReleaseVersion = 0
if (fullLastBetaRelease) {
const lastBetaReleaseRCVersionArray = fullLastBetaRelease.match(/rc.+[0-9]+/g)
const lastBetaReleaseRCVersion =
lastBetaReleaseRCVersionArray && lastBetaReleaseRCVersionArray.length
? lastBetaReleaseRCVersionArray[0]
: null
const lastBetaReleaseVersion = lastBetaReleaseRCVersion
? lastBetaReleaseRCVersion.split('.')[1]
: 0
nextBetaReleaseVersion = parseInt(lastBetaReleaseVersion, 10) + 1
}
// next beta release version. Output: 1.0.0-beta.1.rc.1
const nextBetaReleaseVesionFull = `${package.version}-beta.${issueNumber}.rc.${nextBetaReleaseVersion}`
// update the beta version on package.json
const { error } = await runCommand(
`npm version ${nextBetaReleaseVesionFull} --no-git-tag-version`,
)
if (error) {
console.error(error)
return
}
// the beta version is already updated on package.json on the next line
console.log('Next Beta version: ', `${nextBetaReleaseVesionFull}`)
await runCommand(`echo "NEW_VERSION=${nextBetaReleaseVesionFull}" >> $GITHUB_ENV`)
}
const AutoBetaRelease = async () => {
// get all the versions of the package from npm
const { stdout } = await runCommand(`npm view . versions --json`)
// show npm published versions of this package
console.log(stdout)
// check if there is a beta release with the same issue number on published versions
try {
const arrayOfBetaReleases = JSON.parse(stdout).filter((version) =>
version.includes(`${package.version}-beta.${issueNumber}`),
);
} catch (error) {
console.error('Failed to parse JSON:', error);
return;
}
let fullLastBetaRelease = null
// if yes, get the latest beta release. Output: 1.0.0-beta.1.rc.0
if (arrayOfBetaReleases.length) {
fullLastBetaRelease = arrayOfBetaReleases[arrayOfBetaReleases.length - 1]
}
console.log('Last Beta Release: ', fullLastBetaRelease)
let nextBetaReleaseVersion = 0
if (fullLastBetaRelease) {
const lastBetaReleaseRCVersionArray = fullLastBetaRelease.match(/rc.+[0-9]+/g)
const lastBetaReleaseRCVersion =
lastBetaReleaseRCVersionArray && lastBetaReleaseRCVersionArray.length
? lastBetaReleaseRCVersionArray[0]
: null
const lastBetaReleaseVersion = lastBetaReleaseRCVersion
? lastBetaReleaseRCVersion.split('.')[1]
: 0
nextBetaReleaseVersion = parseInt(lastBetaReleaseVersion, 10) + 1
}
// next beta release version. Output: 1.0.0-beta.1.rc.1
const nextBetaReleaseVesionFull = `${package.version}-beta.${issueNumber}.rc.${nextBetaReleaseVersion}`
// update the beta version on package.json
const { error } = await runCommand(
`npm version ${nextBetaReleaseVesionFull} --no-git-tag-version`,
)
if (error) {
console.error(error)
return
}
// the beta version is already updated on package.json on the next line
console.log('Next Beta version: ', `${nextBetaReleaseVesionFull}`)
await runCommand(`echo "NEW_VERSION=${nextBetaReleaseVesionFull}" >> $GITHUB_ENV`)
}

await runCommand(`echo "NEW_VERSION=${nextBetaReleaseVesionFull}" >> $GITHUB_ENV`)
}

AutoBetaRelease()
Copy link

Choose a reason for hiding this comment

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

Consider wrapping the AutoBetaRelease function call in a condition or exporting it as a module to provide more control over its execution.

+ if (require.main === module) {
+   AutoBetaRelease();
+ }

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
AutoBetaRelease()
if (require.main === module) {
AutoBetaRelease();
}

@danielbarion danielbarion merged commit e59397c into master May 8, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants