Skip to content

Merge pull request #54 from vektor-inc/fix/deploy-0-2-6 #29

Merge pull request #54 from vektor-inc/fix/deploy-0-2-6

Merge pull request #54 from vektor-inc/fix/deploy-0-2-6 #29

Workflow file for this run

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Deploy to VWS
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
env:
plugin_name: lightning-g3-evergreen
jobs:
php_unit:
name: php unit test
runs-on: ubuntu-latest
strategy:
matrix:
php: [7.4, 8.0, 8.1]
services:
mysql:
image: mysql:5.7
ports:
- 3306
env:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
steps:
- uses: actions/checkout@v2
# get the node version from the .node-version file
- name: Read .node-version
run: echo "##[set-output name=NODEVERSION;]$(cat .node-version)"
id: nodenv
# setup node based on the version from the .node-version file, fetched in the previous step
- name: Setup Node.js (.node-version)
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nodenv.outputs.NODEVERSION }}"
- name: Cache multiple paths
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Install Node Scripts
run: npm install
- name: Install Composer Packages
run: composer install
- name: Build
run: npm run build
- name: Install Lightning Theme
run: |
curl -s https://downloads.wordpress.org/theme/lightning.zip -o theme.zip
mkdir temp
unzip theme.zip -d temp/themes
rm -f theme.zip
- name: Install Lightning G3 Pro Unit
run: |
curl -sL "${{ secrets.G3_PRO_UNIT_URL }}" -o plugin.zip
unzip plugin.zip -d temp/plugins
rm -f plugin.zip
- name: Run @wordpress/env
run: |
npx wp-env destroy
npx wp-env start
- name: PHP Unit Test
run: npm run phpunit
deploy:
runs-on: ubuntu-latest
needs: [php_unit]
steps:
- uses: actions/checkout@v2
# get the node version from the .node-version file
- name: Read .node-version
run: echo "##[set-output name=NODEVERSION;]$(cat .node-version)"
id: nodenv
# setup node based on the version from the .node-version file, fetched in the previous step
- name: Setup Node.js (.node-version)
uses: actions/setup-node@v1
with:
node-version: "${{ steps.nodenv.outputs.NODEVERSION }}"
- name: Setup PHP 7.4
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- name: Install NPM Scripts
run: npm install
- name: Install Composer Packages
run: composer install
- name: Build
run: npm run build
- name: Make Distribution
run: |
npm run dist
cd dist/ && zip -r ${{ env.plugin_name }}.zip ${{ env.plugin_name }}/ && mv ${{ env.plugin_name }}.zip ${GITHUB_WORKSPACE}
- name: rsync deployments
uses: burnett01/[email protected]
with:
switches: -avzr
path: ${{ env.plugin_name }}.zip
remote_path: ${{ secrets.DEPLOY_PATH_VWS }}
remote_host: ${{ secrets.DEPLOY_HOST_VWS }}
remote_port: ${{ secrets.DEPLOY_PORT_VWS }}
remote_user: ${{ secrets.DEPLOY_USER_VWS }}
remote_key: ${{ secrets.DEPLOY_KEY_VWS }}
remote_key_pass: ${{ secrets.DEPLOY_KEYPASS_VWS }}