Builds an artifact according to the configuration file (artifact-configuration.json) in the calling repository.
When using zip the generated artifact is called artifact.zip and is stored in /github/workspace
This can be used in an automated release workflow to create assets, as seen here
Simply add the action to your workflow
- name: Create release package
uses: serucee/php-artifact-action@master
And add artifact-configuration.json
to your repository.
Below you can find an example configuration.
The script takes the full configuration out of the artifact-configuration.json
since it was created with the purpose
to be used in several php projects and I wanted to avoid passing too many parameters in the workflow files.
{
"package": {
"type": "zip"
}
}
{
"package": {
"type": "zip",
"execution-path": "/github/workspace",
"file-blacklist": ["randomfile.txt", "*.md*"],
"folder-blacklist": ["randomfolder", "tests"]
},
"composer": {
"execution-path": "/github/workspace"
}
}
The folder blacklist automatically gets wrapped with '$value/*'
The main.php
file is the main file called through entrypoint.sh
in the container.
It calls the required objects in the correct order and executes the necessary methods.
The Builder folder currently contains the PackageConfigurationBuilder
to be able to use different output formats in the future.
The Exception folder contains all the defined exceptions used in the project.
The Helper folder contains helpers and classes that actually execute or run something.
ArrayHelper
The ArrayHelper contains methods useful for handling arraysExceptionHelper
The ExceptionHelper is a wrapper for exception handling to return correct output for entrypoint.shFileParserAbstract
The FileParserAbstract is a base class for file parsers, so several configuration types are possible in the future.FileParserJson
The FileParserJson extends the FileParserAbstract and returns the parsed file as an array.Parser Interface
The Parser Interface is used to have a common interface for parsers.Runner
The Runner executes bash commands using configuration objects.
The Model folder contains configuration objects used by helpers.
ComposerConfiguration
The ComposerConfiguration contains all necessary information the Runner needs to execute composer commands.Configuration
The Configuration acts as a DTO for all configuration objects used.ConfigurationAbstract
The ConfigurationAbstract is used to define all base methods Configuration objects require for the Runner.PackageConfigurationAbstract
The PackageConfigurationAbstract is a layer to support different package types in the future.PackageConfigurationZip
The PackageConfigurationZip contains all necessary information the Runner needs to execute a zip command.