Merge pull request #184 from shivammathur/develop

2.0.1
This commit is contained in:
Shivam Mathur 2020-02-19 09:08:04 +05:30 committed by GitHub
commit cdfbf6d0f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 36 deletions

View File

@ -20,9 +20,6 @@ inputs:
tools: tools:
description: 'Setup popular tools globally.' description: 'Setup popular tools globally.'
required: false required: false
update:
description: 'Update PHP if already installed.'
required: false
runs: runs:
using: 'node12' using: 'node12'
main: 'dist/index.js' main: 'dist/index.js'

46
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "setup-php", "name": "setup-php",
"version": "2.0.0", "version": "2.0.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -678,9 +678,9 @@
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
"version": "13.7.1", "version": "13.7.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.7.1.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-13.7.2.tgz",
"integrity": "sha512-Zq8gcQGmn4txQEJeiXo/KiLpon8TzAl0kmKH4zdWctPj05nWwp1ClMdAVEloqrQKfaC48PNLdgN/aVaLqUrluA==", "integrity": "sha512-uvilvAQbdJvnSBFcKJ2td4016urcGvsiR+N4dHGU87ml8O2Vl6l+ErOi9w0kXSPiwJ1AYlIW+0pDXDWWMOiWbw==",
"dev": true "dev": true
}, },
"@types/parse-json": { "@types/parse-json": {
@ -711,12 +711,12 @@
"dev": true "dev": true
}, },
"@typescript-eslint/eslint-plugin": { "@typescript-eslint/eslint-plugin": {
"version": "2.19.2", "version": "2.20.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.19.2.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.20.0.tgz",
"integrity": "sha512-HX2qOq2GOV04HNrmKnTpSIpHjfl7iwdXe3u/Nvt+/cpmdvzYvY0NHSiTkYN257jHnq4OM/yo+OsFgati+7LqJA==", "integrity": "sha512-cimIdVDV3MakiGJqMXw51Xci6oEDEoPkvh8ggJe2IIzcc0fYqAxOXN6Vbeanahz6dLZq64W+40iUEc9g32FLDQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/experimental-utils": "2.19.2", "@typescript-eslint/experimental-utils": "2.20.0",
"eslint-utils": "^1.4.3", "eslint-utils": "^1.4.3",
"functional-red-black-tree": "^1.0.1", "functional-red-black-tree": "^1.0.1",
"regexpp": "^3.0.0", "regexpp": "^3.0.0",
@ -724,32 +724,32 @@
} }
}, },
"@typescript-eslint/experimental-utils": { "@typescript-eslint/experimental-utils": {
"version": "2.19.2", "version": "2.20.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.19.2.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.20.0.tgz",
"integrity": "sha512-B88QuwT1wMJR750YvTJBNjMZwmiPpbmKYLm1yI7PCc3x0NariqPwqaPsoJRwU9DmUi0cd9dkhz1IqEnwfD+P1A==", "integrity": "sha512-fEBy9xYrwG9hfBLFEwGW2lKwDRTmYzH3DwTmYbT+SMycmxAoPl0eGretnBFj/s+NfYBG63w/5c3lsvqqz5mYag==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/json-schema": "^7.0.3", "@types/json-schema": "^7.0.3",
"@typescript-eslint/typescript-estree": "2.19.2", "@typescript-eslint/typescript-estree": "2.20.0",
"eslint-scope": "^5.0.0" "eslint-scope": "^5.0.0"
} }
}, },
"@typescript-eslint/parser": { "@typescript-eslint/parser": {
"version": "2.19.2", "version": "2.20.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.19.2.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.20.0.tgz",
"integrity": "sha512-8uwnYGKqX9wWHGPGdLB9sk9+12sjcdqEEYKGgbS8A0IvYX59h01o8os5qXUHMq2na8vpDRaV0suTLM7S8wraTA==", "integrity": "sha512-o8qsKaosLh2qhMZiHNtaHKTHyCHc3Triq6aMnwnWj7budm3xAY9owSZzV1uon5T9cWmJRJGzTFa90aex4m77Lw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/eslint-visitor-keys": "^1.0.0", "@types/eslint-visitor-keys": "^1.0.0",
"@typescript-eslint/experimental-utils": "2.19.2", "@typescript-eslint/experimental-utils": "2.20.0",
"@typescript-eslint/typescript-estree": "2.19.2", "@typescript-eslint/typescript-estree": "2.20.0",
"eslint-visitor-keys": "^1.1.0" "eslint-visitor-keys": "^1.1.0"
} }
}, },
"@typescript-eslint/typescript-estree": { "@typescript-eslint/typescript-estree": {
"version": "2.19.2", "version": "2.20.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.19.2.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.20.0.tgz",
"integrity": "sha512-Xu/qa0MDk6upQWqE4Qy2X16Xg8Vi32tQS2PR0AvnT/ZYS4YGDvtn2MStOh5y8Zy2mg4NuL06KUHlvCh95j9C6Q==", "integrity": "sha512-WlFk8QtI8pPaE7JGQGxU7nGcnk1ccKAJkhbVookv94ZcAef3m6oCE/jEDL6dGte3JcD7reKrA0o55XhBRiVT3A==",
"dev": true, "dev": true,
"requires": { "requires": {
"debug": "^4.1.1", "debug": "^4.1.1",
@ -2198,9 +2198,9 @@
} }
}, },
"figures": { "figures": {
"version": "3.1.0", "version": "3.2.0",
"resolved": "https://registry.npmjs.org/figures/-/figures-3.1.0.tgz", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz",
"integrity": "sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg==", "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==",
"dev": true, "dev": true,
"requires": { "requires": {
"escape-string-regexp": "^1.0.5" "escape-string-regexp": "^1.0.5"

View File

@ -1,6 +1,6 @@
{ {
"name": "setup-php", "name": "setup-php",
"version": "2.0.0", "version": "2.0.1",
"private": false, "private": false,
"description": "Setup PHP for use with GitHub Actions", "description": "Setup PHP for use with GitHub Actions",
"main": "dist/index.js", "main": "dist/index.js",
@ -31,9 +31,9 @@
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^25.1.2", "@types/jest": "^25.1.2",
"@types/node": "^13.7.1", "@types/node": "^13.7.2",
"@typescript-eslint/eslint-plugin": "^2.19.2", "@typescript-eslint/eslint-plugin": "^2.20.0",
"@typescript-eslint/parser": "^2.19.2", "@typescript-eslint/parser": "^2.20.0",
"@zeit/ncc": "^0.21.1", "@zeit/ncc": "^0.21.1",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0", "eslint-config-prettier": "^6.10.0",

View File

@ -25,7 +25,6 @@ update_ppa() {
ppa="ondrej-ubuntu-php*.list" ppa="ondrej-ubuntu-php*.list"
fi fi
find /etc/apt/sources.list.d -type f -name "$ppa" -exec sudo "$debconf_fix" apt-fast update -o Dir::Etc::sourcelist="{}" ';' >/dev/null 2>&1 find /etc/apt/sources.list.d -type f -name "$ppa" -exec sudo "$debconf_fix" apt-fast update -o Dir::Etc::sourcelist="{}" ';' >/dev/null 2>&1
echo "true"
fi fi
} }
@ -60,7 +59,7 @@ add_extension() {
install_command=$2 install_command=$2
prefix=$3 prefix=$3
if [[ "$version" =~ $old_versions ]]; then if [[ "$version" =~ $old_versions ]]; then
install_command="ppa_updated=$(update_ppa) && ${install_command/5\.[4-5]-$extension/5-$extension=$release_version}" install_command="update_ppa && ${install_command/5\.[4-5]-$extension/5-$extension=$release_version} && ppa_updated='true'"
fi fi
if ! php -m | grep -i -q -w "$extension" && [ -e "$ext_dir/$extension.so" ]; then if ! php -m | grep -i -q -w "$extension" && [ -e "$ext_dir/$extension.so" ]; then
# shellcheck disable=SC2046 # shellcheck disable=SC2046
@ -70,7 +69,7 @@ add_extension() {
add_log "$tick" "$extension" "Enabled" add_log "$tick" "$extension" "Enabled"
elif ! php -m | grep -i -q -w "$extension"; then elif ! php -m | grep -i -q -w "$extension"; then
(eval "$install_command" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") || (eval "$install_command" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
(ppa_updated=$(update_ppa) && eval "$install_command" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") || (update_ppa && eval "$install_command" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled" && ppa_updated="true") ||
(sudo pecl install -f "$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") || (sudo pecl install -f "$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver" add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
fi fi
@ -88,7 +87,7 @@ delete_extension() {
# Function to disable and delete extensions # Function to disable and delete extensions
remove_extension() { remove_extension() {
extension=$1 extension=$1
if [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then if [[ ! "$version" =~ $old_versions ]] && [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then
sudo phpdismod -v "$version" "$extension" sudo phpdismod -v "$version" "$extension"
fi fi
delete_extension "$extension" delete_extension "$extension"
@ -140,7 +139,8 @@ update_extension() {
if [ "$final_version" != "$current_version" ]; then if [ "$final_version" != "$current_version" ]; then
version_exists=$(apt-cache policy -- *"$extension" | grep "$final_version") version_exists=$(apt-cache policy -- *"$extension" | grep "$final_version")
if [ -z "$version_exists" ]; then if [ -z "$version_exists" ]; then
ppa_updated=$(update_ppa) update_ppa
ppa_updated="true"
fi fi
$apt_install php"$version"-"$extension" $apt_install php"$version"-"$extension"
fi fi
@ -267,7 +267,8 @@ if [ "$existing_version" != "$version" ]; then
else else
version_exists=$(apt-cache policy -- php"$version" | grep "$version") version_exists=$(apt-cache policy -- php"$version" | grep "$version")
if [ -z "$version_exists" ]; then if [ -z "$version_exists" ]; then
ppa_updated=$(update_ppa) update_ppa
ppa_updated="true"
fi fi
$apt_install php"$version" php"$version"-curl php"$version"-mbstring php"$version"-xml >/dev/null 2>&1 $apt_install php"$version" php"$version"-curl php"$version"-mbstring php"$version"-xml >/dev/null 2>&1
fi fi