Compare commits
1 Commits
1668116eec
...
58cd5d025e
| Author | SHA1 | Date | |
|---|---|---|---|
| 58cd5d025e |
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6.0.2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
|||||||
16
.github/workflows/test.yml
vendored
16
.github/workflows/test.yml
vendored
@@ -10,14 +10,13 @@ jobs:
|
|||||||
name: Test Node
|
name: Test Node
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
- name: Test action with Node.js (npm)
|
- name: Test action with Node.js (npm)
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
install-node: 'true'
|
install-node: 'true'
|
||||||
node-version: '24'
|
node-version: '24'
|
||||||
package-manager: 'npm'
|
|
||||||
server-path: './test-server'
|
server-path: './test-server'
|
||||||
|
|
||||||
- name: Verify installation
|
- name: Verify installation
|
||||||
@@ -37,7 +36,7 @@ jobs:
|
|||||||
name: Test PHP
|
name: Test PHP
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
- name: Test action with PHP
|
- name: Test action with PHP
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -64,7 +63,7 @@ jobs:
|
|||||||
name: Test nginx
|
name: Test nginx
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
- name: Test action with nginx
|
- name: Test action with nginx
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -86,7 +85,7 @@ jobs:
|
|||||||
name: Test All Components
|
name: Test All Components
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
- name: Test action with all components
|
- name: Test action with all components
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -96,7 +95,6 @@ jobs:
|
|||||||
install-nginx: 'true'
|
install-nginx: 'true'
|
||||||
node-version: '24'
|
node-version: '24'
|
||||||
php-version: '8.5'
|
php-version: '8.5'
|
||||||
package-manager: 'npm'
|
|
||||||
server-path: './test-server'
|
server-path: './test-server'
|
||||||
|
|
||||||
- name: Verify installation
|
- name: Verify installation
|
||||||
@@ -125,7 +123,7 @@ jobs:
|
|||||||
name: Test Custom Server Path
|
name: Test Custom Server Path
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
- name: Test action with custom path
|
- name: Test action with custom path
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -152,7 +150,7 @@ jobs:
|
|||||||
name: Test Without Dependencies
|
name: Test Without Dependencies
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
- name: Test action without installing dependencies
|
- name: Test action without installing dependencies
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -176,7 +174,7 @@ jobs:
|
|||||||
name: Test Build Command
|
name: Test Build Command
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
- name: Test action with build command
|
- name: Test action with build command
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|||||||
149
QUICK_START.md
149
QUICK_START.md
@@ -1,149 +0,0 @@
|
|||||||
# Quick Start Guide
|
|
||||||
|
|
||||||
Get started with the Server Install Action in minutes!
|
|
||||||
|
|
||||||
## 1. Choose Your Components
|
|
||||||
|
|
||||||
The action installs the Nodarx server and can set up Node.js, PHP, and/or nginx based on your needs.
|
|
||||||
|
|
||||||
## 2. Basic Examples
|
|
||||||
|
|
||||||
### Node.js Only (Unit Tests)
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: Node.js Tests
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: Nodarx/action-server-install@v2
|
|
||||||
with:
|
|
||||||
install-node: 'true'
|
|
||||||
```
|
|
||||||
|
|
||||||
### PHP Only (Unit Tests)
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: PHP Tests
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: Nodarx/action-server-install@v2
|
|
||||||
with:
|
|
||||||
install-php: 'true'
|
|
||||||
```
|
|
||||||
|
|
||||||
### All Components (Integration Tests)
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: Integration Tests
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: Nodarx/action-server-install@v2
|
|
||||||
with:
|
|
||||||
install-node: 'true'
|
|
||||||
install-php: 'true'
|
|
||||||
install-nginx: 'true'
|
|
||||||
```
|
|
||||||
|
|
||||||
## 3. Customize Components
|
|
||||||
|
|
||||||
### Node.js with Specific Version
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: Nodarx/action-server-install@v2
|
|
||||||
with:
|
|
||||||
install-node: 'true'
|
|
||||||
node-version: '20'
|
|
||||||
package-manager: 'pnpm' # or 'npm', 'yarn'
|
|
||||||
```
|
|
||||||
|
|
||||||
### PHP with Custom Extensions
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: Nodarx/action-server-install@v2
|
|
||||||
with:
|
|
||||||
install-php: 'true'
|
|
||||||
php-version: '8.2'
|
|
||||||
php-extensions: 'mbstring, xml, pdo, pdo_mysql'
|
|
||||||
```
|
|
||||||
|
|
||||||
### nginx with Custom Config
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: Nodarx/action-server-install@v2
|
|
||||||
with:
|
|
||||||
install-nginx: 'true'
|
|
||||||
nginx-config: './config/nginx.conf'
|
|
||||||
```
|
|
||||||
|
|
||||||
## 4. Component Combinations
|
|
||||||
|
|
||||||
You can enable any combination of components:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# Node.js + nginx (for frontend tests)
|
|
||||||
install-node: 'true'
|
|
||||||
install-nginx: 'true'
|
|
||||||
|
|
||||||
# PHP + nginx (for backend tests)
|
|
||||||
install-php: 'true'
|
|
||||||
install-nginx: 'true'
|
|
||||||
|
|
||||||
# All three (full integration)
|
|
||||||
install-node: 'true'
|
|
||||||
install-php: 'true'
|
|
||||||
install-nginx: 'true'
|
|
||||||
```
|
|
||||||
|
|
||||||
## 5. Common Options
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: Nodarx/action-server-install@v2
|
|
||||||
with:
|
|
||||||
# Components (at least one required)
|
|
||||||
install-node: 'true' # Install Node.js
|
|
||||||
install-php: 'true' # Install PHP
|
|
||||||
install-nginx: 'true' # Install nginx
|
|
||||||
|
|
||||||
# Server configuration
|
|
||||||
server-path: './server' # Where to clone (default)
|
|
||||||
|
|
||||||
# Node.js options (if install-node: true)
|
|
||||||
node-version: '20'
|
|
||||||
package-manager: 'npm'
|
|
||||||
|
|
||||||
# PHP options (if install-php: true)
|
|
||||||
php-version: '8.2'
|
|
||||||
php-extensions: 'mbstring, xml, ctype'
|
|
||||||
|
|
||||||
# nginx options (if install-nginx: true)
|
|
||||||
nginx-config: './nginx.conf'
|
|
||||||
|
|
||||||
# General options
|
|
||||||
install-dependencies: 'true'
|
|
||||||
build-command: 'npm run build'
|
|
||||||
env-file: '.env.production'
|
|
||||||
post-install-script: './scripts/setup.sh'
|
|
||||||
```
|
|
||||||
|
|
||||||
- Check the [README.md](README.md) for detailed documentation
|
|
||||||
- See [test workflow](.github/workflows/test.yml) for more usage examples
|
|
||||||
- Read [CONTRIBUTING.md](CONTRIBUTING.md) to contribute
|
|
||||||
- Report issues or request features in [Issues](../../issues)
|
|
||||||
|
|
||||||
## Need Help?
|
|
||||||
|
|
||||||
- 📖 [Full Documentation](README.md)
|
|
||||||
- 💬 [Discussions](../../discussions)
|
|
||||||
- 🐛 [Report a Bug](../../issues/new?template=bug_report.md)
|
|
||||||
- ✨ [Request a Feature](../../issues/new?template=feature_request.md)
|
|
||||||
127
README.md
127
README.md
@@ -1,14 +1,12 @@
|
|||||||
# Server Install Action
|
# Server Install Action
|
||||||
|
|
||||||
A GitHub Action to clone the Nodarx server repository and install Node.js, PHP, and/or nginx based on test requirements. Perfect for creating lean test environments (e.g., JS tests install only Node) while supporting full integration tests with all components.
|
A action to clone the Nodarx server repository and install Node.js, PHP, and/or nginx based on test requirements. Perfect for creating lean test environments (e.g., JS tests install only Node) while supporting full integration tests with all components.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- ✅ Clone Nodarx server repository with submodule support
|
- ✅ Clone Nodarx server repository with submodule support
|
||||||
- ✅ Flexible component installation (Node.js, PHP, nginx)
|
- ✅ Flexible component installation (Node.js, PHP, nginx)
|
||||||
- ✅ Support for multiple Node.js package managers (npm, yarn, pnpm)
|
|
||||||
- ✅ Automatic dependency installation (npm, composer)
|
- ✅ Automatic dependency installation (npm, composer)
|
||||||
- ✅ Environment file configuration
|
|
||||||
- ✅ Custom build commands
|
- ✅ Custom build commands
|
||||||
- ✅ Post-installation scripts
|
- ✅ Post-installation scripts
|
||||||
- ✅ Comprehensive error handling and logging
|
- ✅ Comprehensive error handling and logging
|
||||||
@@ -26,11 +24,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Install Server with Node.js
|
- name: Install Server with Node.js
|
||||||
uses: Nodarx/action-server-install@v2
|
uses: Nodarx/action-server-install@v1
|
||||||
with:
|
with:
|
||||||
install-node: 'true'
|
install-node: 'true'
|
||||||
node-version: '20'
|
node-version: '24'
|
||||||
package-manager: 'npm'
|
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
@@ -49,10 +46,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Install Server with PHP
|
- name: Install Server with PHP
|
||||||
uses: Nodarx/action-server-install@v2
|
uses: Nodarx/action-server-install@v1
|
||||||
with:
|
with:
|
||||||
install-php: 'true'
|
install-php: 'true'
|
||||||
php-version: '8.2'
|
php-version: '8.5'
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
@@ -71,13 +68,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Install Server with All Components
|
- name: Install Server with All Components
|
||||||
uses: Nodarx/action-server-install@v2
|
uses: Nodarx/action-server-install@v1
|
||||||
with:
|
with:
|
||||||
install-node: 'true'
|
install-node: 'true'
|
||||||
install-php: 'true'
|
install-php: 'true'
|
||||||
install-nginx: 'true'
|
install-nginx: 'true'
|
||||||
node-version: '20'
|
node-version: '24'
|
||||||
php-version: '8.2'
|
php-version: '8.5'
|
||||||
|
|
||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
run: |
|
run: |
|
||||||
@@ -89,7 +86,7 @@ jobs:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install Server with nginx
|
- name: Install Server with nginx
|
||||||
uses: Nodarx/action-server-install@v2
|
uses: Nodarx/action-server-install@v1
|
||||||
with:
|
with:
|
||||||
install-nginx: 'true'
|
install-nginx: 'true'
|
||||||
nginx-config: './config/nginx.conf'
|
nginx-config: './config/nginx.conf'
|
||||||
@@ -105,26 +102,19 @@ jobs:
|
|||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Create environment file
|
|
||||||
run: |
|
|
||||||
echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" > .env.production
|
|
||||||
echo "API_KEY=${{ secrets.API_KEY }}" >> .env.production
|
|
||||||
|
|
||||||
- name: Install Server
|
- name: Install Server
|
||||||
uses: Nodarx/action-server-install@v2
|
uses: Nodarx/action-server-install@v1
|
||||||
with:
|
with:
|
||||||
server-path: './server'
|
server-path: './server'
|
||||||
install-node: 'true'
|
install-node: 'true'
|
||||||
install-php: 'true'
|
install-php: 'true'
|
||||||
install-nginx: 'true'
|
install-nginx: 'true'
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
package-manager: 'pnpm'
|
|
||||||
php-version: '8.2'
|
php-version: '8.2'
|
||||||
php-extensions: 'mbstring, xml, ctype, json, curl, zip, pdo, pdo_mysql'
|
php-extensions: 'mbstring, xml, ctype, json, curl, zip, pdo, pdo_mysql'
|
||||||
nginx-config: './config/nginx.conf'
|
nginx-config: './config/nginx.conf'
|
||||||
install-dependencies: 'true'
|
install-dependencies: 'true'
|
||||||
build-command: 'npm run build'
|
build-command: 'npm run build'
|
||||||
env-file: '.env.production'
|
|
||||||
post-install-script: './scripts/post-install.sh'
|
post-install-script: './scripts/post-install.sh'
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -147,21 +137,20 @@ jobs:
|
|||||||
| `server-path` | Path where the server will be cloned/installed | No | `./server` |
|
| `server-path` | Path where the server will be cloned/installed | No | `./server` |
|
||||||
| `install-dependencies` | Whether to install dependencies (npm/composer) | No | `true` |
|
| `install-dependencies` | Whether to install dependencies (npm/composer) | No | `true` |
|
||||||
| `build-command` | Custom build command to run after install | No | `''` |
|
| `build-command` | Custom build command to run after install | No | `''` |
|
||||||
| `env-file` | Path to environment file to copy (.env) | No | `''` |
|
|
||||||
| `post-install-script` | Custom script to run after installation | No | `''` |
|
| `post-install-script` | Custom script to run after installation | No | `''` |
|
||||||
|
|
||||||
### Node.js Configuration
|
### Node.js Configuration
|
||||||
|
|
||||||
| Input | Description | Required | Default |
|
| Input | Description | Required | Default |
|
||||||
|-------|-------------|----------|---------|
|
|-------|-------------|----------|---------|
|
||||||
| `node-version` | Node.js version to use | No | `20` |
|
| `node-version` | Node.js version to use | No | `24` |
|
||||||
| `package-manager` | Package manager for Node.js (npm, yarn, pnpm) | No | `npm` |
|
|
||||||
|
|
||||||
### PHP Configuration
|
### PHP Configuration
|
||||||
|
|
||||||
| Input | Description | Required | Default |
|
| Input | Description | Required | Default |
|
||||||
|-------|-------------|----------|---------|
|
|-------|-------------|----------|---------|
|
||||||
| `php-version` | PHP version to use | No | `8.2` |
|
| `php-version` | PHP version to use | No | `8.5` |
|
||||||
| `php-extensions` | Comma-separated list of PHP extensions to install | No | `mbstring, xml, ctype, json, curl, zip` |
|
| `php-extensions` | Comma-separated list of PHP extensions to install | No | `mbstring, xml, ctype, json, curl, zip` |
|
||||||
|
|
||||||
### nginx Configuration
|
### nginx Configuration
|
||||||
@@ -180,46 +169,19 @@ jobs:
|
|||||||
| `php-installed` | Whether PHP was installed (true/false) |
|
| `php-installed` | Whether PHP was installed (true/false) |
|
||||||
| `nginx-installed` | Whether nginx was installed (true/false) |
|
| `nginx-installed` | Whether nginx was installed (true/false) |
|
||||||
|
|
||||||
## Component Details
|
|
||||||
|
|
||||||
### Server Repository
|
|
||||||
- Clones from: `https://git.ktrix.dev/Nodarx/server`
|
|
||||||
- Includes recursive submodule initialization
|
|
||||||
- Updates existing directory if already present
|
|
||||||
|
|
||||||
### Node.js
|
|
||||||
- Uses `actions/setup-node@v4` for Node.js setup
|
|
||||||
- **npm**: Uses `npm ci` (with fallback to `npm install`)
|
|
||||||
- **yarn**: Uses `yarn install --frozen-lockfile` (with fallback)
|
|
||||||
- **pnpm**: Uses `pnpm install --frozen-lockfile` (with fallback, requires `pnpm/action-setup`)
|
|
||||||
- Default version: Node.js 20 (LTS)
|
|
||||||
|
|
||||||
### PHP
|
|
||||||
- Uses `shivammathur/setup-php@v2` for PHP setup
|
|
||||||
- Default version: PHP 8.2
|
|
||||||
- Default extensions: mbstring, xml, ctype, json, curl, zip
|
|
||||||
- **composer**: Uses `composer install --no-dev --optimize-autoloader`
|
|
||||||
- Skips gracefully if no `composer.json` found
|
|
||||||
|
|
||||||
### nginx
|
|
||||||
- Installs via system package manager (`apt-get`)
|
|
||||||
- Supports optional custom configuration file
|
|
||||||
- Automatically starts the nginx service
|
|
||||||
- Validates configuration before reload
|
|
||||||
|
|
||||||
## Best Practices
|
## Best Practices
|
||||||
|
|
||||||
1. **Enable only needed components**: For faster test runs
|
1. **Enable only needed components**: For faster test runs
|
||||||
```yaml
|
```yaml
|
||||||
# JS unit tests - Node.js only
|
# JS unit tests - Node.js only
|
||||||
- uses: Nodarx/action-server-install@v2
|
- uses: Nodarx/action-server-install@v1
|
||||||
with:
|
with:
|
||||||
install-node: 'true'
|
install-node: 'true'
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Pin to specific versions**: Use commit SHA or version tag
|
2. **Pin to specific versions**: Use commit SHA or version tag
|
||||||
```yaml
|
```yaml
|
||||||
uses: Nodarx/action-server-install@v2.0.0
|
uses: Nodarx/action-server-install@v1.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
3. **Cache dependencies**: Combine with caching for faster builds
|
3. **Cache dependencies**: Combine with caching for faster builds
|
||||||
@@ -229,24 +191,12 @@ jobs:
|
|||||||
path: ~/.npm
|
path: ~/.npm
|
||||||
key: ${{ runner.os }}-node-${{ hashFiles('server/package-lock.json') }}
|
key: ${{ runner.os }}-node-${{ hashFiles('server/package-lock.json') }}
|
||||||
|
|
||||||
- uses: Nodarx/action-server-install@v2
|
- uses: Nodarx/action-server-install@v1
|
||||||
with:
|
with:
|
||||||
install-node: 'true'
|
install-node: 'true'
|
||||||
```
|
```
|
||||||
|
|
||||||
4. **Secure secrets**: Use GitHub Secrets for sensitive variables
|
4. **Test different component combinations**: Matrix testing
|
||||||
```yaml
|
|
||||||
- name: Create .env file
|
|
||||||
run: |
|
|
||||||
echo "API_KEY=${{ secrets.API_KEY }}" > .env.production
|
|
||||||
|
|
||||||
- uses: Nodarx/action-server-install@v2
|
|
||||||
with:
|
|
||||||
install-node: 'true'
|
|
||||||
env-file: '.env.production'
|
|
||||||
```
|
|
||||||
|
|
||||||
5. **Test different component combinations**: Matrix testing
|
|
||||||
```yaml
|
```yaml
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -262,49 +212,6 @@ jobs:
|
|||||||
install-php: 'true'
|
install-php: 'true'
|
||||||
```
|
```
|
||||||
|
|
||||||
## Development
|
|
||||||
|
|
||||||
### Local Testing
|
|
||||||
|
|
||||||
To test this action locally, you can use [act](https://github.com/nektos/act):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
act -j test -W .github/workflows/test.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
### Contributing
|
|
||||||
|
|
||||||
1. Fork the repository
|
|
||||||
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
||||||
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
||||||
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
||||||
5. Open a Pull Request
|
|
||||||
|
|
||||||
## Versioning
|
|
||||||
|
|
||||||
This action follows [Semantic Versioning](https://semver.org/). For the versions available, see the [tags on this repository](../../tags).
|
|
||||||
|
|
||||||
### Major Version Tags
|
|
||||||
|
|
||||||
Major version tags (v1, v2, etc.) are maintained to point to the latest minor/patch release within that major version:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
uses: Nodarx/action-server-install@v1 # always latest v1.x.x
|
|
||||||
uses: Nodarx/action-server-install@v1.2 # always latest v1.2.x
|
|
||||||
uses: Nodarx/action-server-install@v1.2.3 # exact version
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||||
|
|
||||||
## Support
|
|
||||||
|
|
||||||
If you encounter any issues or have questions:
|
|
||||||
- Open an [issue](../../issues)
|
|
||||||
- Check [existing discussions](../../discussions)
|
|
||||||
|
|
||||||
## Acknowledgments
|
|
||||||
|
|
||||||
- Inspired by GitHub's official actions
|
|
||||||
- Built with the GitHub Actions community
|
|
||||||
|
|||||||
81
action.yml
81
action.yml
@@ -31,10 +31,6 @@ inputs:
|
|||||||
description: 'Node.js version to use (if install-node is true)'
|
description: 'Node.js version to use (if install-node is true)'
|
||||||
required: false
|
required: false
|
||||||
default: '24'
|
default: '24'
|
||||||
package-manager:
|
|
||||||
description: 'Package manager for Node.js (npm, yarn, pnpm)'
|
|
||||||
required: false
|
|
||||||
default: 'npm'
|
|
||||||
php-version:
|
php-version:
|
||||||
description: 'PHP version to use (if install-php is true)'
|
description: 'PHP version to use (if install-php is true)'
|
||||||
required: false
|
required: false
|
||||||
@@ -51,10 +47,6 @@ inputs:
|
|||||||
description: 'Custom build command to run after install'
|
description: 'Custom build command to run after install'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
env-file:
|
|
||||||
description: 'Path to environment file to copy (.env)'
|
|
||||||
required: false
|
|
||||||
default: ''
|
|
||||||
post-install-script:
|
post-install-script:
|
||||||
description: 'Custom script to run after installation'
|
description: 'Custom script to run after installation'
|
||||||
required: false
|
required: false
|
||||||
@@ -95,7 +87,7 @@ runs:
|
|||||||
|
|
||||||
echo "Server path: ${{ inputs.server-path }}"
|
echo "Server path: ${{ inputs.server-path }}"
|
||||||
echo "Components to install:"
|
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-php }}" == "true" ] && echo " ✓ PHP ${{ inputs.php-version }}"
|
||||||
[ "${{ inputs.install-nginx }}" == "true" ] && echo " ✓ nginx"
|
[ "${{ inputs.install-nginx }}" == "true" ] && echo " ✓ nginx"
|
||||||
echo "Install dependencies: ${{ inputs.install-dependencies }}"
|
echo "Install dependencies: ${{ inputs.install-dependencies }}"
|
||||||
@@ -118,21 +110,15 @@ runs:
|
|||||||
echo "Repository cloned/updated successfully"
|
echo "Repository cloned/updated successfully"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node
|
||||||
if: inputs.install-node == 'true'
|
if: inputs.install-node == 'true'
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6.2.0
|
||||||
with:
|
with:
|
||||||
node-version: ${{ inputs.node-version }}
|
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
|
- name: Setup PHP
|
||||||
if: inputs.install-php == 'true'
|
if: inputs.install-php == 'true'
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2.36.0
|
||||||
with:
|
with:
|
||||||
php-version: ${{ inputs.php-version }}
|
php-version: ${{ inputs.php-version }}
|
||||||
extensions: ${{ inputs.php-extensions }}
|
extensions: ${{ inputs.php-extensions }}
|
||||||
@@ -146,7 +132,7 @@ runs:
|
|||||||
echo "::group::Installing nginx"
|
echo "::group::Installing nginx"
|
||||||
sudo apt-get update -qq
|
sudo apt-get update -qq
|
||||||
sudo apt-get install -y nginx
|
sudo apt-get install -y nginx
|
||||||
echo "nginx installed successfully"
|
echo "✓ nginx installed successfully"
|
||||||
nginx -v
|
nginx -v
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
@@ -159,12 +145,12 @@ runs:
|
|||||||
if [ -f "${{ inputs.nginx-config }}" ]; then
|
if [ -f "${{ inputs.nginx-config }}" ]; then
|
||||||
sudo cp "${{ inputs.nginx-config }}" /etc/nginx/sites-available/default
|
sudo cp "${{ inputs.nginx-config }}" /etc/nginx/sites-available/default
|
||||||
sudo nginx -t
|
sudo nginx -t
|
||||||
echo "nginx configured successfully"
|
echo "✓ nginx configured successfully"
|
||||||
else
|
else
|
||||||
echo "::warning::nginx config file not found: ${{ inputs.nginx-config }}"
|
echo "::warning::nginx config file not found: ${{ inputs.nginx-config }}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "::endgroup:"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Start nginx
|
- name: Start nginx
|
||||||
if: inputs.install-nginx == 'true'
|
if: inputs.install-nginx == 'true'
|
||||||
@@ -179,33 +165,17 @@ runs:
|
|||||||
if pgrep nginx >/dev/null; then
|
if pgrep nginx >/dev/null; then
|
||||||
echo "✓ nginx is running"
|
echo "✓ nginx is running"
|
||||||
fi
|
fi
|
||||||
echo "nginx started successfully"
|
echo "✓ nginx started successfully"
|
||||||
echo "::endgroup:"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Install Node.js dependencies
|
- name: Install Node dependencies
|
||||||
if: inputs.install-node == 'true' && inputs.install-dependencies == 'true'
|
if: inputs.install-node == 'true' && inputs.install-dependencies == 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "::group::Installing Node.js dependencies"
|
echo "::group::Installing Node dependencies"
|
||||||
cd "${{ inputs.server-path }}"
|
cd "${{ inputs.server-path }}"
|
||||||
|
npm ci || npm install
|
||||||
case "${{ inputs.package-manager }}" in
|
echo "✓ Node dependencies installed successfully"
|
||||||
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"
|
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Install PHP dependencies
|
- name: Install PHP dependencies
|
||||||
@@ -214,29 +184,8 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
echo "::group::Installing PHP dependencies"
|
echo "::group::Installing PHP dependencies"
|
||||||
cd "${{ inputs.server-path }}"
|
cd "${{ inputs.server-path }}"
|
||||||
|
composer install --optimize-autoloader
|
||||||
if [ -f "composer.json" ]; then
|
echo "✓ PHP dependencies installed successfully"
|
||||||
composer install --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
|
|
||||||
|
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Run build command
|
- name: Run build command
|
||||||
|
|||||||
Reference in New Issue
Block a user