-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new action responsible for setting env variables, especially it e…
…nsures node and php versions are adapted to the PrestaSHop version
- Loading branch information
1 parent
961fedd
commit 49c4b22
Showing
10 changed files
with
90 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Setup env variables dynamically | ||
description: Some environment variables are a bit complex to specify and can not be set with simple native functions from GA so we use this action to define them and force them in the Github environment | ||
inputs: | ||
repository_ref: | ||
description: Base branch/ref from the repository | ||
required: true | ||
php_version: | ||
description: PHP version | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set dynamic environment variables | ||
run: | | ||
function version { printf "%03d%03d%03d%03d" $(echo "$1" | sed s/x/999/ | tr '.' ' '); } | ||
if [ $(version $repository_ref) -lt $(version 1.7.7) ]; then | ||
echo Version under 1.7.7 use Node 8 | ||
nodeVersion=8 | ||
elif [ $(version $repository_ref) -lte $(version 1.7.7.x) ]; then | ||
echo Version 1.7.7 uses Node 10 | ||
nodeVersion=10 | ||
elif [ $(version $repository_ref) -lte $(version 1.7.8.x) ]; then | ||
echo Version 1.7.8 uses Node 14 | ||
nodeVersion=14 | ||
else | ||
echo Versions after 1.7.8 use Node 16 | ||
nodeVersion=16 | ||
fi | ||
echo "NODE_VERSION=$nodeVersion" >> $GITHUB_ENV | ||
phpVersion=${{ inputs.php_version }} | ||
if [ $(version $repository_ref) -lte $(version 1.7.4.x) ] && [ $(version $phpVersion) -gt $(version 7.1.x) ]; then | ||
echo Max PHP version for PrestaShop lower than 1.7.4 is 7.1 | ||
phpVersion=7.1 | ||
elif [ $(version $repository_ref) -lte $(version 1.7.6.x) ] && [ $(version $phpVersion) -gt $(version 7.2.x) ]; then | ||
echo Max PHP version for PrestaShop 1.7.5 and 1.7.6 is 7.2 | ||
phpVersion=7.2 | ||
elif [ $(version $repository_ref) -lte $(version 1.7.7.x) ] && [ $(version $phpVersion) -gt $(version 7.3.x) ]; then | ||
echo Max PHP version for PrestaShop 1.7.7 is 7.3 | ||
phpVersion=7.3 | ||
elif [ $(version $repository_ref) -lte $(version 1.7.8.x) ] && [ $(version $phpVersion) -gt $(version 7.4.x) ]; then | ||
echo Max PHP version for PrestaShop 1.7.8 is 7.4 | ||
phpVersion=7.3 | ||
elif [ $(version $repository_ref) -lte $(version 8.1.x) ] && [ $(version $phpVersion) -gt $(version 8.1.x) ]; then | ||
echo Max PHP version for PrestaShop 8.0 and 8.1 is 8.1 | ||
phpVersion=8.1 | ||
fi | ||
echo "PHP_VERSION=$phpVersion" >> $GITHUB_ENV | ||
# Docker version to use based on PHP versions | ||
echo "VERSION=$phpVersion-apache" >> $GITHUB_ENV | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.