Skip to content

Merge pull request #2262 from vektor-inc/develop #146

Merge pull request #2262 from vektor-inc/develop

Merge pull request #2262 from vektor-inc/develop #146

name: Release GitHub and Deploy to test server
on:
push:
tags:
- "pre_[0-9]+.[0-9]+.[0-9]+.[0-9]+"
env:
plugin_name: vk-blocks-pro
jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
# [ Start ] pre_ リリース と 本リリースで同じ処理 ##########################################
- uses: actions/checkout@v2
# 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@v2
with:
node-version: 20.x
- name: Install NPM Scripts
run: npm install
# ビルドで翻訳処理があるため wp-env が必要
- name: Setup PHP 7.4
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- name: Install Composer Package
run: composer install
- name: Install @wordpress/env
run: npm install -g @wordpress/env
- name: Run @wordpress/env
run: wp-env start
- name: Install WP-CLI
run: |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
- name: Make Distribution
# npm run dist の中で npm run build して composer install --no-dev した上で dist して ( compose install しなおして ) いる
# build 漏れの状態で dist してしまう事がないように dist の中に build を含めている
run: |
npm run dist
cd dist/ && zip -r ${{ env.plugin_name }}.zip ${{ env.plugin_name }}/ && mv ${{ env.plugin_name }}.zip ${GITHUB_WORKSPACE}
- run : test -e ${{ env.plugin_name }}.zip
# [ End ] pre_ リリース と 本リリースで同じ処理 ##########################################
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.plugin_name }}.zip
asset_name: ${{ env.plugin_name }}.zip
asset_content_type: application/zip
- name: Deploy to test server [ VK Blocks Pro (Single) ]
uses: burnett01/[email protected]
with:
switches: -avzr
path: /dist/vk-blocks-pro/
remote_path: /home/vs4/www/test/vk-blocks-pro/wp-content/plugins/vk-blocks-pro/
remote_host: ${{ secrets.DEPLOY_HOST_VS4 }}
remote_port: ${{ secrets.DEPLOY_PORT_VS4 }}
remote_user: ${{ secrets.DEPLOY_USER_VS4 }}
remote_key: ${{ secrets.DEPLOY_KEY_VS4 }}
- name: Deploy to test server [ Lightning G3 Pro ]
uses: burnett01/[email protected]
with:
switches: -avzr
path: /dist/vk-blocks-pro/
remote_path: /home/vs4/www/test/lightning-g3-pro/wp-content/plugins/vk-blocks-pro/
remote_host: ${{ secrets.DEPLOY_HOST_VS4 }}
remote_port: ${{ secrets.DEPLOY_PORT_VS4 }}
remote_user: ${{ secrets.DEPLOY_USER_VS4 }}
remote_key: ${{ secrets.DEPLOY_KEY_VS4 }}