- Run
composer install
- Get a Github token (with write rights on the repository defined in
config/parameters.yaml
: https://github.com/settings/tokens/new?description=PrestaShopOpenSourceAPI&scopes=repo - Create a bucket on GCP and download a Service Account key file
You should have 3 environment variables defined:
TOKEN
- The Github token required to use the Github APIGOOGLE_APPLICATION_CREDENTIALS
- Path to the json file previously downloaded containing the authentication information to use GCPBUCKET_NAME
- The name of the bucket where json files should be uploaded
- If you get a
Bad credentials
error thrown fromGithubExceptionThrower.php
even if your token is correctly configured in parameters.yml, delete the cache folder, in the terminal you can type:rm -rf var/cache
from the root of the project.
$ ./bin/console downloadNativeModuleFiles
This will download the main file of the module so the app can extract the module's version and the PrestaShop versions compliance.
It will also download the zip release of the module if it isn't already in the GCP bucket, so it can be added later by the command uploadAssets
$ ./bin/console downloadNewPrestaShopReleases
This will download PrestaShop's zip release and the associated xml file so the app can extract the PHP version compatibilities. (Only releases that are not already in the GCP bucket, or having incomplete associated json file (missing xml file for instance) are downloaded).
$ ./bin/console updateModuleConfigFiles
This will add new versions of module with their PrestaShop versions compatibility to the repository defined for the key module_list_repository
in config/parameters.yaml
$ ./bin/console generateJson
This will generate the different json files to be publicly exposed in the public/json/
folder
$ ./bin/console uploadAssets
This will upload the generated json files as well as the new PrestaShop and module's releases to the GCP bucket
$ ./bin/console checkRepos
$ ./bin/console clean all|json|modules|prestashop
$ ./bin/console run
This will execute the 6 following commands:
clean all
downloadNativeModuleFiles
downloadNewPrestaShopReleases
updateModuleConfigFiles
generateJson
uploadAssets
To use this tool with Docker, you have to:
- Build the image:
$ docker build -t distribution-api .
- Run it with the command you want:
$ docker run --rm -v /path/to/credentials.json:/app/credentials.json -e TOKEN=your_github_token -e BUCKET_NAME=distribution-api -e GOOGLE_APPLICATION_CREDENTIALS=credentials.json distribution-api run
http://<domain.to.public.folder>/modules/<prestashop_version>
Returns last version of every native module compatible with the specified PrestaShop version
http://<domain.to.public.folder>/prestashop
Returns every PrestaShop versions
http://<domain.to.public.folder>/prestashop/<channel>
Returns the latest version of the specified channel
<channel>
can be: stable
, rc
or beta
There are 3 targeted environment at the moment:
- Integration: integration-api.prestashop-project.org
- Preproduction: preprod-api.prestashop-project.org
- Production: api.prestashop-project.org
Those edge URLs are hosted at the Cloudflare level, proxyfying the origin GCP Storage.
Being on github we'll use the github workflow as follow:
As you can see from the schema above
- add the label "integration-deployment" to a Pull Request to trigger the deployment of the integration environment and be able to test it
- merge a Pull Request against branch
main
to trigger the deployment of the preprod environment and be able to test it - publish a GitHub release to trigger the deployment of the production environment
The integration-deployment
label, when added to a Pull Request, will run the Integration Workflow which relies on GitHub secrets. These secrets are not available for forks, which means if you add the integration-deployment
label to a Pull Request whose branch is on a fork, it will fail.
If you wish to test a Pull Request using the integration-deployment
label, the branch must be on the upstream repository.