Skip to content

Commit

Permalink
Merge pull request #4 from rosven9856/0.1.4
Browse files Browse the repository at this point in the history
updating contracts and updating docs
  • Loading branch information
rosven9856 authored Aug 23, 2024
2 parents 107827e + 09a98c1 commit 9099cbe
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 56 deletions.
6 changes: 3 additions & 3 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PHP_VERSION="8.3.7-1"
PHP_VERSION="8.3.10-1"

BUILD_DIRECTORY=".build"
BUILD_FILE_NAME="package.zip"
directory=".build"
file="package.zip"
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PHP_VERSION="8.3.7-1"
PHP_VERSION="8.3.10-1"

BUILD_DIRECTORY=".build"
BUILD_FILE_NAME="package.zip"
directory=".build"
file="package.zip"
20 changes: 10 additions & 10 deletions README.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "Composer package action"
description: "With this GitHub Action, you can build a package for the PHP Composer package manager."
inputs:
BUILD_DIRECTORY_NAME:
directory:
description: "The name of the directory for package building"
default: ".build"
BUILD_FILE_NAME:
file:
description: "The name of the built package file"
default: "package.zip"
outputs:
Expand All @@ -16,8 +16,8 @@ runs:
using: "docker"
image: "action.Dockerfile"
args:
- ${{ inputs.BUILD_DIRECTORY_NAME }}
- ${{ inputs.BUILD_FILE_NAME }}
- ${{ inputs.directory }}
- ${{ inputs.file }}
branding:
icon: 'package'
color: 'purple'
4 changes: 2 additions & 2 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
args:
PHP_VERSION: ${PHP_VERSION}
environment:
BUILD_DIRECTORY: ${BUILD_DIRECTORY}
BUILD_FILE_NAME: ${BUILD_FILE_NAME}
directory: ${directory}
file: ${file}
volumes:
- .:/usr/bin/app
Binary file added docs/img/github_gitea_actions.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ public function run(): void
$GITHUB_OUTPUT = (string) $this->configuration->get('GITHUB_OUTPUT');

if (!empty($GITHUB_OUTPUT)) {
$name = 'directory';
$name = 'directory_path';
$value = (string) $this->configuration->get('build.directory');

file_put_contents($GITHUB_OUTPUT, "{$name}={$value}\n", FILE_APPEND);

$name = 'path';
$name = 'file_path';
$value = (string) $this->configuration->get('build.file');

file_put_contents($GITHUB_OUTPUT, "{$name}={$value}\n", FILE_APPEND);
Expand Down
4 changes: 2 additions & 2 deletions src/Configuration/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function __construct()
{
$GITHUB_WORKSPACE = (string) getenv('GITHUB_WORKSPACE');
$GITHUB_OUTPUT = (string) getenv('GITHUB_OUTPUT');
$dirName = (string) getenv('BUILD_DIRECTORY_NAME');
$fileName = (string) getenv('BUILD_FILE_NAME');
$dirName = (string) getenv('directory');
$fileName = (string) getenv('file');

$GITHUB_WORKSPACE = !empty($GITHUB_WORKSPACE) ? $GITHUB_WORKSPACE : realpath(__DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . '..');
$GITHUB_OUTPUT = !empty($GITHUB_OUTPUT) ? $GITHUB_OUTPUT : $GITHUB_WORKSPACE . \DIRECTORY_SEPARATOR . 'var' . \DIRECTORY_SEPARATOR . 'outputcmd.txt';
Expand Down
60 changes: 30 additions & 30 deletions tests/Configuration/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ final class ConfigurationTest extends TestCase
/**
* @var string
*/
private const string DEFAULT_ENV_BUILD_DIRECTORY_NAME = '.build';
private const string DEFAULT_ENV_DIRECTORY = '.build';

/**
* @var string
*/
private const string DEFAULT_ENV_BUILD_FILE_NAME = 'package.zip';
private const string DEFAULT_ENV_FILE = 'package.zip';

/**
* @var string
Expand All @@ -44,12 +44,12 @@ final class ConfigurationTest extends TestCase
/**
* @var string
*/
private const string OTHER_ENV_BUILD_DIRECTORY_NAME = '.build_directory';
private const string OTHER_ENV_DIRECTORY = '.build_directory';

/**
* @var string
*/
private const string OTHER_ENV_BUILD_FILE_NAME = 'build_file.zip';
private const string OTHER_ENV_FILE = 'build_file.zip';

// protected Configuration $configuration;

Expand All @@ -68,8 +68,8 @@ public function testCheckDefaultOptionGitHubWorkspace(): void
{
putenv('GITHUB_WORKSPACE=' . self::DEFAULT_ENV_GITHUB_WORKSPACE);
putenv('GITHUB_OUTPUT=' . self::DEFAULT_ENV_GITHUB_OUTPUT);
putenv('BUILD_DIRECTORY_NAME=' . self::DEFAULT_ENV_BUILD_DIRECTORY_NAME);
putenv('BUILD_FILE_NAME=' . self::DEFAULT_ENV_BUILD_FILE_NAME);
putenv('directory=' . self::DEFAULT_ENV_DIRECTORY);
putenv('file=' . self::DEFAULT_ENV_FILE);

$configuration = new Configuration();

Expand All @@ -86,8 +86,8 @@ public function testCheckDefaultGetRootDirectory(): void
{
putenv('GITHUB_WORKSPACE=' . self::DEFAULT_ENV_GITHUB_WORKSPACE);
putenv('GITHUB_OUTPUT=' . self::DEFAULT_ENV_GITHUB_OUTPUT);
putenv('BUILD_DIRECTORY_NAME=' . self::DEFAULT_ENV_BUILD_DIRECTORY_NAME);
putenv('BUILD_FILE_NAME=' . self::DEFAULT_ENV_BUILD_FILE_NAME);
putenv('directory=' . self::DEFAULT_ENV_DIRECTORY);
putenv('file=' . self::DEFAULT_ENV_FILE);

$configuration = new Configuration();

Expand All @@ -104,8 +104,8 @@ public function testCheckDefaultOptionGitHubOutput(): void
{
putenv('GITHUB_WORKSPACE=' . self::DEFAULT_ENV_GITHUB_WORKSPACE);
putenv('GITHUB_OUTPUT=' . self::DEFAULT_ENV_GITHUB_OUTPUT);
putenv('BUILD_DIRECTORY_NAME=' . self::DEFAULT_ENV_BUILD_DIRECTORY_NAME);
putenv('BUILD_FILE_NAME=' . self::DEFAULT_ENV_BUILD_FILE_NAME);
putenv('directory=' . self::DEFAULT_ENV_DIRECTORY);
putenv('file=' . self::DEFAULT_ENV_FILE);

$configuration = new Configuration();

Expand All @@ -122,14 +122,14 @@ public function testCheckDefaultOptionBuildDirectory(): void
{
putenv('GITHUB_WORKSPACE=' . self::DEFAULT_ENV_GITHUB_WORKSPACE);
putenv('GITHUB_OUTPUT=' . self::DEFAULT_ENV_GITHUB_OUTPUT);
putenv('BUILD_DIRECTORY_NAME=' . self::DEFAULT_ENV_BUILD_DIRECTORY_NAME);
putenv('BUILD_FILE_NAME=' . self::DEFAULT_ENV_BUILD_FILE_NAME);
putenv('directory=' . self::DEFAULT_ENV_DIRECTORY);
putenv('file=' . self::DEFAULT_ENV_FILE);

$configuration = new Configuration();

self::assertEquals(
$configuration->get('build.directory'),
self::DEFAULT_ENV_GITHUB_WORKSPACE . \DIRECTORY_SEPARATOR . self::DEFAULT_ENV_BUILD_DIRECTORY_NAME,
self::DEFAULT_ENV_GITHUB_WORKSPACE . \DIRECTORY_SEPARATOR . self::DEFAULT_ENV_DIRECTORY,
);
}

Expand All @@ -140,15 +140,15 @@ public function testCheckDefaultOptionBuildFile(): void
{
putenv('GITHUB_WORKSPACE=' . self::DEFAULT_ENV_GITHUB_WORKSPACE);
putenv('GITHUB_OUTPUT=' . self::DEFAULT_ENV_GITHUB_OUTPUT);
putenv('BUILD_DIRECTORY_NAME=' . self::DEFAULT_ENV_BUILD_DIRECTORY_NAME);
putenv('BUILD_FILE_NAME=' . self::DEFAULT_ENV_BUILD_FILE_NAME);
putenv('directory=' . self::DEFAULT_ENV_DIRECTORY);
putenv('file=' . self::DEFAULT_ENV_FILE);

$configuration = new Configuration();

self::assertEquals(
$configuration->get('build.file'),
self::DEFAULT_ENV_GITHUB_WORKSPACE . \DIRECTORY_SEPARATOR . self::DEFAULT_ENV_BUILD_DIRECTORY_NAME .
\DIRECTORY_SEPARATOR . self::DEFAULT_ENV_BUILD_FILE_NAME,
self::DEFAULT_ENV_GITHUB_WORKSPACE . \DIRECTORY_SEPARATOR . self::DEFAULT_ENV_DIRECTORY .
\DIRECTORY_SEPARATOR . self::DEFAULT_ENV_FILE,
);
}

Expand All @@ -159,8 +159,8 @@ public function testCheckOtherOptionOptionGitHubOutput(): void
{
putenv('GITHUB_WORKSPACE=' . self::OTHER_ENV_GITHUB_WORKSPACE);
putenv('GITHUB_OUTPUT=' . self::OTHER_ENV_GITHUB_OUTPUT);
putenv('BUILD_DIRECTORY_NAME=' . self::OTHER_ENV_BUILD_DIRECTORY_NAME);
putenv('BUILD_FILE_NAME=' . self::OTHER_ENV_BUILD_FILE_NAME);
putenv('directory=' . self::OTHER_ENV_DIRECTORY);
putenv('file=' . self::OTHER_ENV_FILE);

$configuration = new Configuration();

Expand All @@ -177,8 +177,8 @@ public function testCheckOtherGetRootDirectory(): void
{
putenv('GITHUB_WORKSPACE=' . self::OTHER_ENV_GITHUB_WORKSPACE);
putenv('GITHUB_OUTPUT=' . self::OTHER_ENV_GITHUB_OUTPUT);
putenv('BUILD_DIRECTORY_NAME=' . self::OTHER_ENV_BUILD_DIRECTORY_NAME);
putenv('BUILD_FILE_NAME=' . self::OTHER_ENV_BUILD_FILE_NAME);
putenv('directory=' . self::OTHER_ENV_DIRECTORY);
putenv('file=' . self::OTHER_ENV_FILE);

$configuration = new Configuration();

Expand All @@ -195,8 +195,8 @@ public function testCheckOtherOptionGitHubOutput(): void
{
putenv('GITHUB_WORKSPACE=' . self::OTHER_ENV_GITHUB_WORKSPACE);
putenv('GITHUB_OUTPUT=' . self::OTHER_ENV_GITHUB_OUTPUT);
putenv('BUILD_DIRECTORY_NAME=' . self::OTHER_ENV_BUILD_DIRECTORY_NAME);
putenv('BUILD_FILE_NAME=' . self::OTHER_ENV_BUILD_FILE_NAME);
putenv('directory=' . self::OTHER_ENV_DIRECTORY);
putenv('file=' . self::OTHER_ENV_FILE);

$configuration = new Configuration();

Expand All @@ -213,14 +213,14 @@ public function testCheckOtherOptionBuildDirectory(): void
{
putenv('GITHUB_WORKSPACE=' . self::OTHER_ENV_GITHUB_WORKSPACE);
putenv('GITHUB_OUTPUT=' . self::OTHER_ENV_GITHUB_OUTPUT);
putenv('BUILD_DIRECTORY_NAME=' . self::OTHER_ENV_BUILD_DIRECTORY_NAME);
putenv('BUILD_FILE_NAME=' . self::OTHER_ENV_BUILD_FILE_NAME);
putenv('directory=' . self::OTHER_ENV_DIRECTORY);
putenv('file=' . self::OTHER_ENV_FILE);

$configuration = new Configuration();

self::assertEquals(
$configuration->get('build.directory'),
self::OTHER_ENV_GITHUB_WORKSPACE . \DIRECTORY_SEPARATOR . self::OTHER_ENV_BUILD_DIRECTORY_NAME,
self::OTHER_ENV_GITHUB_WORKSPACE . \DIRECTORY_SEPARATOR . self::OTHER_ENV_DIRECTORY,
);
}

Expand All @@ -231,15 +231,15 @@ public function testCheckOtherOptionBuildFile(): void
{
putenv('GITHUB_WORKSPACE=' . self::OTHER_ENV_GITHUB_WORKSPACE);
putenv('GITHUB_OUTPUT=' . self::OTHER_ENV_GITHUB_OUTPUT);
putenv('BUILD_DIRECTORY_NAME=' . self::OTHER_ENV_BUILD_DIRECTORY_NAME);
putenv('BUILD_FILE_NAME=' . self::OTHER_ENV_BUILD_FILE_NAME);
putenv('directory=' . self::OTHER_ENV_DIRECTORY);
putenv('file=' . self::OTHER_ENV_FILE);

$configuration = new Configuration();

self::assertEquals(
$configuration->get('build.file'),
self::OTHER_ENV_GITHUB_WORKSPACE . \DIRECTORY_SEPARATOR . self::OTHER_ENV_BUILD_DIRECTORY_NAME .
\DIRECTORY_SEPARATOR . self::OTHER_ENV_BUILD_FILE_NAME,
self::OTHER_ENV_GITHUB_WORKSPACE . \DIRECTORY_SEPARATOR . self::OTHER_ENV_DIRECTORY .
\DIRECTORY_SEPARATOR . self::OTHER_ENV_FILE,
);
}
}

0 comments on commit 9099cbe

Please sign in to comment.