chore: update name
All checks were successful
Test Action / Test Node (pull_request) Successful in 14s
Test Action / Test nginx (pull_request) Successful in 16s
Test Action / Test Custom Server Path (pull_request) Successful in 23s
Test Action / Test Build Command (pull_request) Successful in 25s
Test Action / Test PHP (pull_request) Successful in 52s
Test Action / Test All Components (pull_request) Successful in 1m10s
All checks were successful
Test Action / Test Node (pull_request) Successful in 14s
Test Action / Test nginx (pull_request) Successful in 16s
Test Action / Test Custom Server Path (pull_request) Successful in 23s
Test Action / Test Build Command (pull_request) Successful in 25s
Test Action / Test PHP (pull_request) Successful in 52s
Test Action / Test All Components (pull_request) Successful in 1m10s
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
100
action.yml
100
action.yml
@@ -1,4 +1,4 @@
|
||||
name: 'Server Install Action'
|
||||
name: 'Nodarx Server Install Action'
|
||||
description: 'Clone Nodarx server repository and install Node.js, PHP, and/or nginx based on test requirements'
|
||||
author: 'Nodarx'
|
||||
|
||||
@@ -30,20 +30,16 @@ inputs:
|
||||
node-version:
|
||||
description: 'Node.js version to use (if install-node is true)'
|
||||
required: false
|
||||
default: '20'
|
||||
package-manager:
|
||||
description: 'Package manager for Node.js (npm, yarn, pnpm)'
|
||||
required: false
|
||||
default: 'npm'
|
||||
default: '24'
|
||||
php-version:
|
||||
description: 'PHP version to use (if install-php is true)'
|
||||
required: false
|
||||
default: '8.2'
|
||||
default: '8.5'
|
||||
php-extensions:
|
||||
description: 'Comma-separated list of PHP extensions to install'
|
||||
required: false
|
||||
default: 'mbstring, xml, ctype, json, curl, zip'
|
||||
web-config:
|
||||
nginx-config:
|
||||
description: 'Path to nginx configuration file (optional)'
|
||||
required: false
|
||||
default: ''
|
||||
@@ -51,10 +47,6 @@ inputs:
|
||||
description: 'Custom build command to run after install'
|
||||
required: false
|
||||
default: ''
|
||||
env-file:
|
||||
description: 'Path to environment file to copy (.env)'
|
||||
required: false
|
||||
default: ''
|
||||
post-install-script:
|
||||
description: 'Custom script to run after installation'
|
||||
required: false
|
||||
@@ -95,7 +87,7 @@ runs:
|
||||
|
||||
echo "Server path: ${{ inputs.server-path }}"
|
||||
echo "Components to install:"
|
||||
[ "${{ inputs.install-node }}" == "true" ] && echo " ✓ Node.js ${{ inputs.node-version }} (${{ inputs.package-manager }})"
|
||||
[ "${{ inputs.install-node }}" == "true" ] && echo " ✓ Node.js ${{ inputs.node-version }}"
|
||||
[ "${{ inputs.install-php }}" == "true" ] && echo " ✓ PHP ${{ inputs.php-version }}"
|
||||
[ "${{ inputs.install-nginx }}" == "true" ] && echo " ✓ nginx"
|
||||
echo "Install dependencies: ${{ inputs.install-dependencies }}"
|
||||
@@ -118,18 +110,12 @@ runs:
|
||||
echo "Repository cloned/updated successfully"
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Setup Node.js
|
||||
- name: Setup Node
|
||||
if: inputs.install-node == 'true'
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6.2.0
|
||||
with:
|
||||
node-version: ${{ inputs.node-version }}
|
||||
|
||||
- name: Setup pnpm
|
||||
if: inputs.install-node == 'true' && inputs.package-manager == 'pnpm'
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 8
|
||||
|
||||
- name: Setup PHP
|
||||
if: inputs.install-php == 'true'
|
||||
uses: shivammathur/setup-php@v2
|
||||
@@ -140,18 +126,18 @@ runs:
|
||||
coverage: none
|
||||
|
||||
- name: Install nginx
|
||||
if: inputs.install-web-server == 'true'
|
||||
if: inputs.install-nginx == 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::Installing nginx"
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y nginx
|
||||
echo "nginx installed successfully"
|
||||
echo "✓ nginx installed successfully"
|
||||
nginx -v
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Configure nginx
|
||||
if: inputs.install-web-server == 'true' && inputs.nginx-config != ''
|
||||
if: inputs.install-nginx == 'true' && inputs.nginx-config != ''
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::Configuring nginx"
|
||||
@@ -159,8 +145,7 @@ runs:
|
||||
if [ -f "${{ inputs.nginx-config }}" ]; then
|
||||
sudo cp "${{ inputs.nginx-config }}" /etc/nginx/sites-available/default
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
echo "nginx configured successfully"
|
||||
echo "✓ nginx configured successfully"
|
||||
else
|
||||
echo "::warning::nginx config file not found: ${{ inputs.nginx-config }}"
|
||||
fi
|
||||
@@ -168,39 +153,29 @@ runs:
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Start nginx
|
||||
if: inputs.install-web-server == 'true'
|
||||
if: inputs.install-nginx == 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::Starting nginx"
|
||||
sudo systemctl start nginx
|
||||
sudo systemctl status nginx --no-pager || true
|
||||
echo "nginx started successfully"
|
||||
sudo nginx || echo "nginx may already be running"
|
||||
# Verify nginx is working
|
||||
if sudo nginx -t 2>/dev/null; then
|
||||
echo "✓ nginx configuration valid"
|
||||
fi
|
||||
if pgrep nginx >/dev/null; then
|
||||
echo "✓ nginx is running"
|
||||
fi
|
||||
echo "✓ nginx started successfully"
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Install Node.js dependencies
|
||||
- name: Install Node dependencies
|
||||
if: inputs.install-node == 'true' && inputs.install-dependencies == 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::Installing Node.js dependencies"
|
||||
echo "::group::Installing Node dependencies"
|
||||
cd "${{ inputs.server-path }}"
|
||||
|
||||
case "${{ inputs.package-manager }}" in
|
||||
npm)
|
||||
npm ci || npm install
|
||||
;;
|
||||
yarn)
|
||||
yarn install --frozen-lockfile || yarn install
|
||||
;;
|
||||
pnpm)
|
||||
pnpm install --frozen-lockfile || pnpm install
|
||||
;;
|
||||
*)
|
||||
echo "::error::Unsupported package manager: ${{ inputs.package-manager }}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Node.js dependencies installed successfully"
|
||||
npm ci || npm install
|
||||
echo "✓ Node dependencies installed successfully"
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Install PHP dependencies
|
||||
@@ -209,29 +184,8 @@ runs:
|
||||
run: |
|
||||
echo "::group::Installing PHP dependencies"
|
||||
cd "${{ inputs.server-path }}"
|
||||
|
||||
if [ -f "composer.json" ]; then
|
||||
composer install --no-dev --optimize-autoloader
|
||||
echo "PHP dependencies installed successfully"
|
||||
else
|
||||
echo "::warning::composer.json not found, skipping PHP dependency installation"
|
||||
fi
|
||||
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Copy environment file
|
||||
if: inputs.env-file != ''
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::Setting up environment file"
|
||||
|
||||
if [ -f "${{ inputs.env-file }}" ]; then
|
||||
cp "${{ inputs.env-file }}" "${{ inputs.server-path }}/.env"
|
||||
echo "Environment file copied successfully"
|
||||
else
|
||||
echo "::warning::Environment file not found: ${{ inputs.env-file }}"
|
||||
fi
|
||||
|
||||
composer install --optimize-autoloader
|
||||
echo "✓ PHP dependencies installed successfully"
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Run build command
|
||||
|
||||
Reference in New Issue
Block a user