Skip to content

Merge branch 'dev-hiresuit' into staging #7

Merge branch 'dev-hiresuit' into staging

Merge branch 'dev-hiresuit' into staging #7

Workflow file for this run

name: Deploy WordPress Plugin
env:
PHP_VERSION: '8.1'
NODE_VERSION: '16'
PLUGIN_NAME: 'wp-job-openings'
on:
push:
branches:
- staging
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
- name: Cache Composer packages
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install NPM Dependencies
run: npm ci
- name: Install Composer Dependencies
if: hashFiles('composer.json')
run: composer install --no-dev --optimize-autoloader
- name: Build Assets
run: npm run build
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: unnecessary
- name: Adding Known Hosts
run: ssh-keyscan -p 22 -H ${{ secrets.REMOTE_HOST }} >> ~/.ssh/known_hosts
- name: Deploy with rsync
run: rsync -avz -e "ssh -p 22" --exclude='.git' --exclude='.github' --exclude='node_modules' --exclude='.gitignore' --exclude='.eslintrc' --exclude='gulpfile.js' --exclude='package.json' --exclude='package-lock.json' --exclude='composer.json' --exclude='composer.lock' --exclude='.eslintignore' --exclude='.browserslistrc' . ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }}:${{ secrets.REMOTE_PATH }}/wp-content/plugins/${{ env.PLUGIN_NAME }}