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
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions bin/build-website.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,13 @@ function buildMenu($uri, $rstDir, $baseHref)

include __DIR__.'/../vendor/autoload.php';

// This is the version we download for the latest phar file
$pharVersion = '2.7.0';
ravage84 marked this conversation as resolved.
Show resolved Hide resolved

$rstDir = __DIR__.'/../src/site/rst';
$websiteDirectory = __DIR__.'/../dist/website';
$pharDestinationDirectory = $websiteDirectory . '/static/latest';
tvbeek marked this conversation as resolved.
Show resolved Hide resolved
$pharUrl = 'https://github.com/phpmd/phpmd/releases/download/'.$pharVersion.'/phpmd.phar';

$parser = new Parser;
$baseHref = ltrim(getenv('BASE_HREF') ?: '', ':');
Expand All @@ -247,6 +252,10 @@ function buildMenu($uri, $rstDir, $baseHref)
buildWebsite($rstDir, $parser, $websiteDirectory, $changelogContent, $rstDir, $baseHref);
copy($websiteDirectory.'/about.html', $websiteDirectory.'/index.html');

// Copy the phar file to the destination
@mkdir($pharDestinationDirectory, 0777, true);
copy($pharUrl, $pharDestinationDirectory . '/phpmd.phar');

if ($cname = getenv('CNAME')) {
file_put_contents($websiteDirectory.'/CNAME', $cname);
}
2 changes: 1 addition & 1 deletion src/site/rst/download/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Installing as a Phar
You can always fetch the latest stable version as a phar archive through
the following version agnostic link: ::

~ $ wget -c http://static.phpmd.org/php/latest/phpmd.phar
~ $ wget -c https://phpmd.org/static/latest/phpmd.phar

Installing via Composer
=======================
Expand Down