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: auto update ipfs version in installation docs #1081

Merged
merged 3 commits into from
Mar 25, 2022

Conversation

laurentsenta
Copy link
Contributor

@laurentsenta laurentsenta commented Mar 16, 2022

  • Add a current-ipfs-version frontmatter option to make the feature opt-in,
  • Add a search & replace on the ipfs tag.

@welcome
Copy link

welcome bot commented Mar 16, 2022

Thank you for submitting this PR!
A maintainer will be here shortly to review it.
We are super grateful, but we are also overloaded! Help us by making sure that:

  • The context for this PR is clear, with relevant discussion, decisions and stakeholders linked/mentioned.
  • Your contribution itself is clear (grammar and spelling checked, any code blocks checked and commented) and in its best form. Follow the docs contribution guidelines if they apply.

Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
Next steps:

  • A maintainer will triage and assign priority to this PR, commenting on any missing things and potentially assigning a reviewer for high priority items.
  • The PR gets reviews, discussed and approvals as needed.
  • The PR is merged by maintainers when it has been approved and comments addressed.

We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution.
We are very grateful for your contribution!

@laurentsenta
Copy link
Contributor Author

laurentsenta commented Mar 16, 2022

👋 I've experienced this issue a couple of days ago and took a stab at it,
(see also #1074).

(requesting @galargh to preshot the ci code quality before pinging the maintainers)

Copy link
Contributor

@galargh galargh left a comment

Choose a reason for hiding this comment

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

nit: If you place your substitution part after update http-api-docs section, you'd be free to cd $ROOT/docs.

Needs small fixes but overall I think it'd be a quick win here if the maintainers are OK with it. Another approach would be to adopt some proper templating engine for docs generation and use ipfs tag as an input but that's a major undertaking compared to this change so I think we can put it off for now.

.github/actions/update-on-new-ipfs-tag/entrypoint.sh Outdated Show resolved Hide resolved
# update installation docs
while read -r file; do
echo "replacing $CURRENT_IPFS_TAG with $LATEST_IPFS_TAG in $file"
sed -E -i "s/$CURRENT_IPFS_TAG/$LATEST_IPFS_TAG/g" $file
Copy link
Contributor

Choose a reason for hiding this comment

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

Is a situation in which we'd want references to $CURRENT_IPFS_TAG survive a new IPFS tag release? Some that I can think of:

  • referring to an older version of IPFS to highlight some differences between the versions
  • referring to a version of some other thing that just happens to be the same as $CURRENT_IPFS_TAG

Copy link
Contributor Author

@laurentsenta laurentsenta Mar 18, 2022

Choose a reason for hiding this comment

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

👍 Definitely limitations of not using a real templating system.

My assumption is that these are unlikely to happen or might happen once, which will catch at review time.
Because we have the frontmatter requirement and we only transform current version to new version.
(if we document something about versionX specifically, it will be replaced only when we upgrade ipfs from versionX to versionY).

(will let you and the maintainers ack on this)

Copy link
Contributor

@galargh galargh Mar 18, 2022

Choose a reason for hiding this comment

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

Cool with me, thank you for the reply :) That's 👍 from me, I'll let you follow up with the maintainers now.

@@ -1,6 +1,7 @@
---
title: Command-line
description: Using IPFS through the command-line allows you to do everything that IPFS Desktop can do, but at a more granular level since you can specify which commands to run. Learn how to install it here.
current-ipfs-version: v0.12.0
---
Copy link
Contributor Author

@laurentsenta laurentsenta Mar 18, 2022

Choose a reason for hiding this comment

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

Commenting here so we get a thread & trace some research:

Needs small fixes but overall I think it'd be a quick win here if the maintainers are OK with it. Another approach would be to adopt some proper templating engine for docs generation and use ipfs tag as an input but that's a major undertaking compared to this change so I think we can put it off for now.

Agreed, thanks for the feedback @galargh,

FWIW:

There is also a templating feature in vuepress,
but the syntax seems to break markdown URLs. This won't be transformed into a link:

[my link](https://mysite.com/{{ $frontmatter.myVariable }})

And we can't use templating in code blocks.

We could write vuepress plugins, but it would be more time-consuming & invasive.

@filecorgi
Copy link
Contributor

  • Image optimization came back clean!
  • Vuepress build was successful!

@laurentsenta laurentsenta self-assigned this Mar 21, 2022
Copy link
Contributor

@johnnymatthews johnnymatthews left a comment

Choose a reason for hiding this comment

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

This looks good from my end. Might wanna get a SWE to double check stuff though.

@johnnymatthews
Copy link
Contributor

@lidel do you mind giving this PR a look over? My automation skills are pretty lax.

@BigLep BigLep merged commit 54ebc03 into main Mar 25, 2022
@BigLep BigLep deleted the feat/auto-update-ipfs-version branch March 25, 2022 15:35
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

LGTM, but it seems CI shell is no longer bash and we also had dependabot enabled with impacted this workflow.

See follow-up fixes in #1121

while read -r file; do
echo "replacing $CURRENT_IPFS_NUMBER with $LATEST_IPFS_NUMBER in $file"
sed -E -i "s/$CURRENT_IPFS_NUMBER/$LATEST_IPFS_NUMBER/g" $file
done <<< "$(grep "current-ipfs-version" ./docs -R --files-with-matches)"
Copy link
Member

Choose a reason for hiding this comment

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

@laurentsenta turns out when <<< is used we need to make sure we use bash and not sh – see fix in #1121

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.

6 participants