Skip to content

Commit

Permalink
Merge pull request #1 from gocom/feature/update-action-compatibility
Browse files Browse the repository at this point in the history
Support future action runner versions
  • Loading branch information
gocom authored Nov 18, 2022
2 parents 6febea5 + bd5ce91 commit f45faf5
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 21 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM composer
FROM composer:2.4.3 AS composer

FROM php:7.2-cli
FROM php:8.1-cli

COPY --from=composer /usr/bin/composer /usr/bin/composer

Expand All @@ -15,7 +15,7 @@ RUN docker-php-ext-install zip

RUN mkdir -p /composer && mkdir -p /compiler

ENV COMPOSER_HOME = /composer
ENV COMPOSER_HOME /composer

ENV COMPOSER_ALLOW_SUPERUSER 1

Expand Down
16 changes: 9 additions & 7 deletions compile.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,22 @@

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

$stdout = \getenv('GITHUB_OUTPUT') ?: 'output.txt';
$workspace = \getenv('GITHUB_WORKSPACE') ?: \getcwd();
$source = \getenv('INPUT_SOURCE') ?: '';
$output = \getenv('INPUT_OUTPUT') ?: 'build/packages';
$ref = \getenv('GITHUB_REF');
$version = $ref
$inputVersion = $ref
? \basename($ref)
: null;
: '0.0.0';

if (!\is_dir($output)) {
\mkdir("$workspace/$output", 0755, true);
}

$package = (new \Rah\Mtxpc\Compiler())
->useCompression(true)
->setVersion($version)
->setVersion($inputVersion)
->compile("$workspace/$source");

$name = $package->getName();
Expand All @@ -38,16 +39,17 @@

\file_put_contents($workspace . \DIRECTORY_SEPARATOR . $path, $package->getInstaller());

\fwrite(\STDOUT, "::set-output name=compressed::$path\n");
\file_put_contents($stdout, "compressed=$path\n", \FILE_APPEND);

$package = (new \Rah\Mtxpc\Compiler())
->useCompression(false)
->setVersion($inputVersion)
->compile("$workspace/$source");

$path = "${output}/${name}_v${version}.txt";

\file_put_contents($workspace . \DIRECTORY_SEPARATOR . $path, $package->getInstaller());

\fwrite(\STDOUT, "::set-output name=uncompressed::$path\n");
\fwrite(\STDOUT, "::set-output name=version::$version\n");
\fwrite(\STDOUT, "::set-output name=name::$name\n");
\file_put_contents($stdout, "uncompressed=$path\n", \FILE_APPEND);
\file_put_contents($stdout, "version=$version\n", \FILE_APPEND);
\file_put_contents($stdout, "name=$name\n", \FILE_APPEND);
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require": {
"rah/mtxpc": "^0.8.0"
"rah/mtxpc": "0.9.1"
}
}
30 changes: 20 additions & 10 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f45faf5

Please sign in to comment.