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 check updates command #577

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

alexng353
Copy link
Contributor

@alexng353 alexng353 commented Dec 2, 2024

This PR adds automatic (daily) checks for new updates for the CLI, only in interactive mode. Alternatively, a user may manually check for updates using the railway check-updates command.

Automatic daily checks run in interactive mode, in the background, for any command called. If a new version is detected, the CLI will push a message to the user (similar to NPM) that requests they update their CLI.

Manual checks can be run as follows:

railway check-updates

This is what the check-updates command looks like when the version has changed:
image

This is what the check-updates command looks like when the version has not changed:
image

This is what the automatic check looks like when the check detects that the version has changed:
image

The data is grabbed (rather slowly) via the GitHub API (endpoint https://api.github.com/repos/railwayapp/cli/releases/latest), which takes around 700ms to process. This is why we run the check in the background, and even then, we only run it daily.

First run:
image
Second run:
image

@brody192 brody192 changed the title feat: add check updates command feat: add check updates command [WIP] Dec 2, 2024
@alexng353 alexng353 changed the title feat: add check updates command [WIP] feat: add check updates command Dec 4, 2024
@coffee-cup coffee-cup added the release/minor Author minor release label Dec 9, 2024
Copy link
Contributor

@coffee-cup coffee-cup left a comment

Choose a reason for hiding this comment

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

Looking good and just a few comments.

Can you also please add descriptions to any PRs so it makes it easier to review. This should include things like

  • Added commands (screenshots of the output is very useful)
  • Changes to behaviour.

Copy link
Contributor

@coffee-cup coffee-cup left a comment

Choose a reason for hiding this comment

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

Would love to get this merged soon! Just a small merge conflict and a few linting rules but then I think it would be good to go

@alexng353
Copy link
Contributor Author

alexng353 commented Feb 13, 2025

Would love to get this merged soon! Just a small merge conflict and a few linting rules but then I think it would be good to go

Merge conflict rectified via rebase.
Lint fixed with cargo fmt.

Apologies for the initial poor quality of this PR; most of it was discussed over Discord, and I didn't put the effort into reflecting the information here.

Copy link
Collaborator

@Milo123459 Milo123459 left a comment

Choose a reason for hiding this comment

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

looks good!

feat: check for updates in background and print on next run

remove updates check from init, link and run

move functions around in main.rs
Copy link
Collaborator

@Milo123459 Milo123459 left a comment

Choose a reason for hiding this comment

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

lgtm. well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release/minor Author minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants