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 the latest phar file to the GitHub Pages to have a consistent URL #682

Merged
merged 5 commits into from Dec 16, 2019
Merged

Add the latest phar file to the GitHub Pages to have a consistent URL #682

merged 5 commits into from Dec 16, 2019

Conversation

tvbeek
Copy link
Member

@tvbeek tvbeek commented Oct 11, 2019

Type: feature / documentation update
Issue: #619
Breaking change: no

This PR adds the phpmd.phar to the GitHub pages and update the url in the documentation to

I use a variable with the version (line 238) that need to be updated with every new version. Another approach is to read the latest version from the api: https://api.github.com/repos/phpmd/phpmd/releases/latest But then there is a change that we have a version that is the latest but not really the latest that conflicts. (Like if we have a 2.7.0 but after that release a 2.6.2)
If wanted I can refactor this to use the api for the latest version.

After feedback I changed it to use the GitHub Api

@tvbeek tvbeek added Documentation PHAR Issues related to the phar file. labels Oct 11, 2019
Copy link
Member

@kylekatarnls kylekatarnls left a comment

Choose a reason for hiding this comment

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

Version can be calculated automatically

  • 1 style-fix

But I fully approve.

bin/build-website.php Outdated Show resolved Hide resolved
bin/build-website.php Outdated Show resolved Hide resolved
@tvbeek
Copy link
Member Author

tvbeek commented Oct 11, 2019

I changed it to use the GitHub API.

Copy link
Member

@kylekatarnls kylekatarnls left a comment

Choose a reason for hiding this comment

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

Indeed, this would "disallow" us to release minor/patch after a more advanced major/minor.

Then it only allow to download the latest version.

So I propose instead to:

  • loop on all releases of https://api.github.com/repos/phpmd/phpmd/releases (actually there are just 2.6.1 and 2.7.0 now as other tags did not use the GitHub release system and I think it's OK not to keep those releases) then save those releases (if they do not yet exist) at /static/2.7.0/phpmd.phar URL, then keeping all the ->tag_name in an array, you can usort them to get the latest: https://3v4l.org/Gpj2j
  • copy the latest if different from the previous latest

@kylekatarnls kylekatarnls added this to the 2.8.1 milestone Oct 19, 2019
kylekatarnls
kylekatarnls previously approved these changes Oct 22, 2019
Copy link
Member

@kylekatarnls kylekatarnls left a comment

Choose a reason for hiding this comment

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

Hi, for me it's now perfect regarding the script but I realize it's in conflict with #624 that remove bin/build-website.

I will do a branch with both merged to see how to combine.

@tvbeek
Copy link
Member Author

tvbeek commented Oct 22, 2019

Hi, for me it's now perfect regarding the script but I realize it's in conflict with #624 that remove bin/build-website.

I will do a branch with both merged to see how to combine.

Good that you found that, I didn't think about it.

Can you verify the working locally? Maybe I test to much but I now get a 403 on https://api.github.com/repos/phpmd/phpmd/releases

@ravage84 ravage84 changed the title Add the latest phar file to the GitHub Pages to have a consistent url. Add the latest phar file to the GitHub Pages to have a consistent URL Dec 2, 2019
@kylekatarnls kylekatarnls modified the milestones: 2.8.1, 2.8.0 Dec 16, 2019
@kylekatarnls kylekatarnls merged commit f54b1e6 into phpmd:master Dec 16, 2019
@tvbeek tvbeek deleted the add_the_latest_phar_file_to_the_github_pages branch December 16, 2019 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation PHAR Issues related to the phar file. Website
Development

Successfully merging this pull request may close these issues.

None yet

3 participants