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 automatic version updater script and github action #2359

Merged
merged 7 commits into from
Feb 13, 2025

Conversation

barbaraperic
Copy link
Collaborator

@barbaraperic barbaraperic commented Feb 11, 2025

Overview

Added a script that automatically updates lotus versions across filecoin-docs documentation. This helps keep our docs up-to-date without manual updates.

🚨 remove synchronize from update-versions.yml before merging. There for testing

What changed?

  • Created a new script (update-versions.js) that:
    • Updates lotus version numbers in all .md files
    • Handles both lotus-x.x.x formats and standalone version numbers (example: git checkout v1.31.1)
    • you can manually run the command npm run update-version <version-number>, example npm run update-version 1.31.2
  • Added GitHub Actions workflow that:
    • Runs on every open PR manually triggered
    • Fetches the latest Lotus version from GitHub releases
    • If it finds a discrepancy, it creates automated PRs with version updates

How to test?

  1. Check any .md file containing a lotus version reference
  2. Run the script manually: node update-versions.js <new_version>
  3. Verify that all version references are updated correctly
  4. Test with different version formats including:
    • Standard versions (e.g., lotus-1.31.1)
    • Version numbers without prefix
  5. Change lotus version and see if github action opens a new PR with changes reflecting the new lotus version

Here is the test PR created by github action

@barbaraperic barbaraperic self-assigned this Feb 11, 2025
Copy link
Collaborator

@lanzafame lanzafame 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 except the miner/vx.x.x regex issue

@@ -12,14 +12,14 @@ To install Lotus on your computer, follow these steps:
2. Once you have downloaded the binary file, extract the contents to a directory of your choice. For example, if you are using Linux, you can extract the contents to the `/usr/local/bin directory` by running the command:

```sh
sudo tar -C /usr/local/bin -xzf lotus-X.X.X-linux-amd64.tar.gz
sudo tar -C /usr/local/bin -xzf lotus-1.31.3-linux-amd64.tar.gz
```

3. Replace `X.X.X` with the version number of the release you downloaded.
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can remove the instructions to substitute the X.X.X for the version number, same below as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done!

@ianconsolata
Copy link
Contributor

Can we also add a test on all PRs that fails if the current version in the docs matches the current version in the lotus repo? That way we'll know when it gets out of date.

@barbaraperic
Copy link
Collaborator Author

Can we also add a test on all PRs that fails if the current version in the docs matches the current version in the lotus repo? That way we'll know when it gets out of date.

Great idea! We can change the github action to run on every open PR?

@barbaraperic barbaraperic marked this pull request as ready for review February 12, 2025 11:48
@barbaraperic barbaraperic changed the title Add automatic version updater script Add automatic version updater script and github action Feb 12, 2025
Copy link
Member

@smagdali smagdali left a comment

Choose a reason for hiding this comment

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

LGTM, just need to observe that it works ok when the next lotus release happens

@smagdali smagdali merged commit df9524e into main Feb 13, 2025
2 of 4 checks passed
@smagdali smagdali deleted the bp/lotus-variable branch February 13, 2025 11:10
@ianconsolata
Copy link
Contributor

ianconsolata commented Feb 14, 2025

Thinking about my request more, I don't think it's really necessary as long as we are diligent about merging the PRs that get opened on cron. I mostly wanted to make sure we had a test in case that cron breaks, but I think those failures will show up in the Github action logs so we're probably good.

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.

4 participants