Skip to content

Instantly share code, notes, and snippets.

@joseph-farruggio
Last active August 22, 2023 22:00
Show Gist options
  • Save joseph-farruggio/ab5bd63e9db6f95861a4ef576a5d8dba to your computer and use it in GitHub Desktop.
Save joseph-farruggio/ab5bd63e9db6f95861a4ef576a5d8dba to your computer and use it in GitHub Desktop.
Github Action for deploying a WordPress plugin
name: Build and Publish Production Plugin
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install NPM dependencies & Compile assets for production
run: |
npm install
npm run prod
- name: List output files
run: ls
- name: Deploy to Production Server #1
uses: easingthemes/ssh-deploy@v2.1.5
env:
# To generate a new key:
# ssh-keygen -a 100 -t ed25519
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE }}
REMOTE_HOST: ${{ secrets.SSH_HOST }}
REMOTE_USER: ${{ secrets.SSH_USER }}
ARGS: -rltgoDzvO --exclude .git --exclude .github --exclude node_modules --exclude src --exclude cypress
TARGET: /www/wp-content/plugins/{plugin_dir}
- name: Deploy to Production Server #2
uses: easingthemes/ssh-deploy@v2.1.5
env:
# To generate a new key:
# ssh-keygen -a 100 -t ed25519
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE }}
REMOTE_HOST: ${{ secrets.SSH_HOST_2 }}
REMOTE_USER: ${{ secrets.SSH_USER_2 }}
ARGS: -rltgoDzvO --exclude .git --exclude .github --exclude node_modules --exclude src --exclude cypress
TARGET: /www/wp-content/plugins/{plugin_dir}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment